{"id":17916,"date":"2024-10-18T10:14:44","date_gmt":"2024-10-18T10:14:44","guid":{"rendered":"http:\/\/www.max-sperling.bplaced.net\/?p=17916"},"modified":"2025-02-25T15:22:45","modified_gmt":"2025-02-25T15:22:45","slug":"basic-docker-commands","status":"publish","type":"post","link":"http:\/\/www.max-sperling.bplaced.net\/?p=17916","title":{"rendered":"Basic docker commands"},"content":{"rendered":"<p><strong>Builder<\/strong><\/p>\n<table>\n<colgroup width=\"40%\" \/>\n<colgroup width=\"60%\" \/>\n<tr>\n<td>Build an image (from a dockerfile)<\/td>\n<td>docker buildx build -t {image} -f {dockerfile} {path}<\/td>\n<\/tr>\n<\/table>\n<hr>\n<p><strong>Images<\/strong><\/p>\n<table>\n<colgroup width=\"40%\" \/>\n<colgroup width=\"60%\" \/>\n<tr>\n<td>Pull an image (from remote)<\/td>\n<td>docker image pull {image}<\/td>\n<\/tr>\n<tr>\n<td>Push an image (to remote)<\/td>\n<td>docker image push {image}<\/td>\n<\/tr>\n<tr>\n<td>List the images<\/td>\n<td>docker image ls<\/td>\n<\/tr>\n<tr>\n<td>Remove an image<\/td>\n<td>docker image rm {image}<\/td>\n<\/tr>\n<\/table>\n<hr>\n<p><strong>Containers<\/strong><\/p>\n<table>\n<colgroup width=\"40%\" \/>\n<colgroup width=\"60%\" \/>\n<tr>\n<td>List the containers<\/td>\n<td>docker container ls -a<\/td>\n<\/tr>\n<tr>\n<td>Create\/+start a container<\/td>\n<td>docker container create\/run {image}<\/td>\n<\/tr>\n<tr>\n<td>Start\/pause\/stop a container<\/td>\n<td>docker container start\/pause\/stop {container}<\/td>\n<\/tr>\n<tr>\n<td>Remove a container<\/td>\n<td>docker container rm {container}<\/td>\n<\/tr>\n<\/table>\n<details>\n<summary>\u25bc More &#8230;<\/summary>\n<table>\n<colgroup width=\"40%\" \/>\n<colgroup width=\"60%\" \/>\n<tr>\n<td>Run container endlessly<\/td>\n<td>docker container run -d {image} sleep infinity<\/td>\n<\/tr>\n<tr>\n<td>Execute specific command<\/td>\n<td>docker container exec -it {container} {cmd}<\/td>\n<\/tr>\n<\/table>\n<ul>\n<li>-d &#8230; Detached mode<\/li>\n<li>-i &#8230; Keep STDIN open<\/li>\n<li>-t &#8230; Allocate a pseudo-TTY<\/li>\n<\/ul>\n<\/details>\n<hr>\n<p><strong>Network<\/strong><\/p>\n<table>\n<colgroup width=\"40%\" \/>\n<colgroup width=\"60%\" \/>\n<tr>\n<td>Create a network<\/td>\n<td>docker network create {network}<\/td>\n<\/tr>\n<tr>\n<td>Remove a network<\/td>\n<td>docker network rm {network}<\/td>\n<\/tr>\n<tr>\n<td>List the networks<\/td>\n<td>docker network ls<\/td>\n<\/tr>\n<tr>\n<td>Inspect a network<\/td>\n<td>docker network inspect {network}<\/td>\n<\/tr>\n<\/table>\n<hr>\n<p><strong>Other<\/strong><\/p>\n<table>\n<colgroup width=\"40%\" \/>\n<colgroup width=\"60%\" \/>\n<tr>\n<td>Remove all data<\/td>\n<td>docker system prune -a<\/td>\n<\/tr>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Builder Build an image (from a dockerfile) docker buildx build -t {image} -f {dockerfile} {path} Images Pull an image (from<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[82],"tags":[],"_links":{"self":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/17916"}],"collection":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17916"}],"version-history":[{"count":28,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/17916\/revisions"}],"predecessor-version":[{"id":18466,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/17916\/revisions\/18466"}],"wp:attachment":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17916"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}