{"id":5499,"date":"2025-03-23T06:50:42","date_gmt":"2025-03-23T06:50:42","guid":{"rendered":"https:\/\/codethataint.com\/blog\/?p=5499"},"modified":"2025-03-23T06:53:34","modified_gmt":"2025-03-23T06:53:34","slug":"docker-basic-commands","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/docker-basic-commands\/","title":{"rendered":"Docker Basic Commands"},"content":{"rendered":"<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\/\/Displays all available Images\r\n&gt;&gt;docker images \r\n\r\n\/\/Displays List of Containers Running \r\n&gt;&gt;docker ps \r\n\r\n(or)\r\n\r\n&gt;&gt;docker container ls\r\n\r\n\/\/Start Container by loading latest Image\r\n&gt;&gt;docker run -d ngnix:latest \r\n\r\n\/\/Start Container by loading latest Image\r\n&gt;&gt;docker run -d ngnix:latest \r\n\r\n\/\/Stop Container \r\n&gt;&gt;docker stop CONTAINER_ID(or)CONTAINER_NAME\r\n\r\n\r\n\/\/Display all Container irrespective of stopped or running\r\n&gt;&gt;docker rm CONTAINER_ID\r\n\r\n\/\/Remove Container\r\n&gt;&gt;docker ps -a\r\n\r\n\/\/Get ID of all containers\r\n&gt;&gt;docker ps -aq\r\n\r\n\/\/Remove all stopped containers by ID\r\n&gt;&gt;docker rm $(docker ps -aq)\r\n\r\n\/\/Remove all containers(stopped and running) by ID\r\n&gt;&gt;docker rm -f $(docker ps -aq)\r\n\r\n\/\/Give CUSTOM_NAME to Container\r\n&gt;&gt;docker run --name CONTAINER_CUSTOM_NAME ngnix:latest\r\n\r\n\/\/Stop Container by CUSTOM_NAME\r\n&gt;&gt;docker stop CONTAINER_CUSTOM_NAME\r\n\r\n\/\/Display list of Containers Running by setting Format\r\n&gt;&gt;docker ps --format=&quot;CUSTOM_FORMAT&quot;\r\n\r\n\/\/Using Export Constant Variable\r\n&gt;&gt;export format = &quot;CUSTOM_FORMAT&quot;\r\n&gt;&gt;docker ps --format=${format}\r\n\r\n\/\/Map Host Port to Docker Container Port\r\n&gt;&gt;docker run -d -p 8080:80 ngnix:latest\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/\/Displays all available Images &gt;&gt;docker images \/\/Displays List of Containers Running &gt;&gt;docker ps (or) &gt;&gt;docker container ls \/\/Start Container by loading latest Image &gt;&gt;docker run -d ngnix:latest \/\/Start Container by loading latest Image &gt;&gt;docker run -d ngnix:latest \/\/Stop Container &gt;&gt;docker stop CONTAINER_ID(or)CONTAINER_NAME \/\/Display all Container irrespective of stopped or running &gt;&gt;docker rm CONTAINER_ID \/\/Remove Container&hellip; <a href=\"https:\/\/codethataint.com\/blog\/docker-basic-commands\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[370],"tags":[],"class_list":["post-5499","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/5499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=5499"}],"version-history":[{"count":5,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/5499\/revisions"}],"predecessor-version":[{"id":5504,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/5499\/revisions\/5504"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=5499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=5499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=5499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}