{"id":6957,"date":"2017-09-06T11:40:45","date_gmt":"2017-09-06T03:40:45","guid":{"rendered":"http:\/\/rmohan.com\/?p=6957"},"modified":"2017-09-06T11:40:45","modified_gmt":"2017-09-06T03:40:45","slug":"docker-cmd","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6957","title":{"rendered":"docker cmd"},"content":{"rendered":"<p>Basic Instructions<\/p>\n<p>Download the image file<\/p>\n<p>$ docker pull image_name<\/p>\n<p>Activate or deactivate the container<br \/>\n$ docker [start|stop] container_name<\/p>\n<p>Download the image file<\/p>\n<p>$ docker pull image_name<\/p>\n<p>Activate or deactivate the container<\/p>\n<p>$ docker [start|stop] container_name<br \/>\nBuild -> Start -> Execute command ( -ti parameter)<\/p>\n<p>$ docker run -ti &#8211;name container_name image_name command<br \/>\nBuild -> Start -> Execute command -> Delete Container ( -rm parameters)<\/p>\n<p>$ docker run &#8211;rm -ti image_name command<br \/>\nfile system and the corresponding port ( -v and -p parameter)<\/p>\n<p>$ docker run -ti &#8211;rm -p 80:80 -v \/your_path:\/container_path -e PASSWORD=1234 image_name<br \/>\nDocker Clear (cleanup) instruction<br \/>\nDelete all container being executed<\/p>\n<p>$ docker kill $(docker ps -q)<\/p>\n<p>Remove dangling image file<\/p>\n<p>docker rmi $(docker images -q -f dangling=true)<\/p>\n<p>Remove all stopped container<\/p>\n<p>docker rm $(docker ps -a -q)<br \/>\nDocker machine instruction<\/p>\n<p>Start machine<\/p>\n<p>$ docker-machine start machine_name<\/p>\n<p>Specifies the machine to set the docker<\/p>\n<p>$ eval &#8220;$(docker-machine env machine_name)&#8221;<br \/>\nInteractive instruction with container<\/p>\n<p>Instruction in the container<\/p>\n<p>$ docker exec -ti container_name command<\/p>\n<p>Online Watch container logs<\/p>\n<p>$ docker logs -ft container_name<\/p>\n<p>Storage container being implemented into image files<\/p>\n<p>$ docker commit -m &#8220;message&#8221; -a &#8220;author&#8221; container_name username\/image_name:tag<\/p>\n<p>docker compose format<\/p>\n<p>docker-compose.yml following format<\/p>\n<p>version: &#8220;2&#8221;<br \/>\nservice:<br \/>\n  container_name: &#8220;hello-world&#8221;<br \/>\n  image: golang<br \/>\n  command: &#8220;go run hello-world.go&#8221;<br \/>\n  ports<br \/>\n    &#8211; &#8220;80:8080&#8221;<br \/>\n  volumes:<br \/>\n    &#8211; \/hello-world:\/root\/hello-world<br \/>\nredis:<br \/>\n  image: redis<\/p>\n<p>Build -> Execute container<\/p>\n<p>$ docker-compose up<br \/>\nThese are commonly used docker instruction, be sure to learn for beginners. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Basic Instructions<\/p>\n<p>Download the image file<\/p>\n<p>$ docker pull image_name<\/p>\n<p>Activate or deactivate the container $ docker [start|stop] container_name<\/p>\n<p>Download the image file<\/p>\n<p>$ docker pull image_name<\/p>\n<p>Activate or deactivate the container<\/p>\n<p>$ docker [start|stop] container_name Build -> Start -> Execute command ( -ti parameter)<\/p>\n<p>$ docker run -ti &#8211;name container_name image_name command Build -> [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[82],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6957"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6957"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6957\/revisions"}],"predecessor-version":[{"id":6958,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6957\/revisions\/6958"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6957"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}