{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreicxed5hgtwr37mr6htf5nqcl4g62e2hxql2qbywy7dbqlleqz5zae",
    "commit": {
      "cid": "bafyreifelrw2sh5q54d5qzn5qqv7fda7xa3uj44rwmv7cdzamyh3zlzspu",
      "rev": "3mpedbjezr727"
    },
    "uri": "at://did:plc:eseoyklmv42do4rllmnakszt/app.bsky.feed.post/3mpedbjcfxc2x",
    "validationStatus": "valid"
  },
  "content": {
    "$type": "pub.leaflet.content",
    "pages": [
      {
        "$type": "pub.leaflet.pages.linearDocument",
        "blocks": [
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.image",
              "aspectRatio": {
                "height": 768,
                "width": 1376
              },
              "image": {
                "$type": "blob",
                "ref": {
                  "$link": "bafkreiby4uipfnamlbaybfq357ivfqdp3evg6i7wkcbllmad4jfpqfk5ka"
                },
                "mimeType": "image/webp",
                "size": 142212
              }
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "plaintext": ""
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "plaintext": "Common commands for building, running, inspecting, and operating a development workflow inside Docker containers."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 2,
              "plaintext": "Quick Start"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "language": "shellscript",
              "plaintext": "# Build an image from the current directory.\n\ndocker build -t my-app:dev .\n\n​# Run an interactive shell in a new container.\n\ndocker run --rm -it my-app:dev sh\n\n​# Run the app and publish a port.\n\ndocker run --rm -it -p 3000:3000 my-app:dev​\n\n# Mount the current project into the container.\n\ndocker run --rm -it -v \"$PWD:/app\" -w /app my-app:dev sh",
              "syntaxHighlightingTheme": "dracula"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 2,
              "plaintext": "Images"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "language": "shellscript",
              "plaintext": "# List local images.\n\ndocker images​\n\n# Build without using cache.\n\ndocker build --no-cache -t my-app:dev .​\n\n# Remove an image.\n\ndocker rmi my-app:dev\n\n​# Remove unused images.\n\ndocker image prune",
              "syntaxHighlightingTheme": "dracula"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 2,
              "plaintext": "Containers"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "language": "shellscript",
              "plaintext": "# List running containers.\n\ndocker ps​\n\n# List all containers, including stopped ones.\n\ndocker ps -a\n\n​# Stop a container.\n\ndocker stop <container>​\n\n# Remove a stopped container.\n\ndocker rm <container>\n\n​# Stop and remove a running container.\n\ndocker rm -f <container>",
              "syntaxHighlightingTheme": "dracula"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 2,
              "plaintext": "Running Dev Commands"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "language": "shellscript",
              "plaintext": "# Run a one-off command.\n\ndocker run --rm my-app:dev npm test​\n\n# Run a shell with the project mounted.\n\ndocker run --rm -it -v \"$PWD:/app\" -w /app my-app:dev bash​\n\n# Run as your host user to avoid root-owned files.\n\ndocker run --rm -it \\  \n  -u \"$(id -u):$(id -g)\" \\\n  -v \"$PWD:/app\" \\\n  -w /app \\\n  my-app:dev sh\n\n​# Pass environment variables.\n\ndocker run --rm -it -e NODE_ENV=development my-app:dev​\n\n# Load environment variables from a file.\n\ndocker run --rm -it --env-file .env my-app:dev",
              "syntaxHighlightingTheme": "dracula"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 2,
              "plaintext": "Logs And Debugging"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "language": "shellscript",
              "plaintext": "# Show logs for a container.\n\ndocker logs <container>​\n\n# Follow logs.docker logs -f <container>\n\n​# Open a shell in a running container.\n\ndocker exec -it <container> sh​\n\n# Inspect container configuration.\n\ndocker inspect <container>​\n\n# Show live container resource usage.\n\ndocker stats",
              "syntaxHighlightingTheme": "dracula"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 2,
              "plaintext": "Volumes"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "language": "shellscript",
              "plaintext": "# List volumes.\n\ndocker volume ls\n\n​# Create a named volume.\n\ndocker volume create my-app-data\n\n​# Use a named volume.\n\ndocker run --rm -it -v my-app-data:/data my-app:dev\n\n​# Remove unused volumes.\n\ndocker volume prune",
              "syntaxHighlightingTheme": "dracula"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 2,
              "plaintext": "Networks"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "language": "shellscript",
              "plaintext": "# List networks.\n\ndocker network ls​\n\n# Create a network.\n\ndocker network create my-dev-network\n\n​# Run a container on a network.\n\ndocker run --rm -it --network my-dev-network my-app:dev",
              "syntaxHighlightingTheme": "dracula"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 2,
              "plaintext": "Docker Compose"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "language": "shellscript",
              "plaintext": "# Start services.\n\ndocker compose up\n\n​# Start services in the background.\n\ndocker compose up -d​\n\n# Rebuild and start services.\n\ndocker compose up --build​\n\n# Stop services.\n\ndocker compose down\n\n​# Stop services and remove volumes.\n\ndocker compose down -v​\n\n# View running Compose services.\n\ndocker compose ps​\n\n# Follow service logs.\n\ndocker compose logs -f\n\n​# Follow logs for one service.\n\ndocker compose logs -f <service>​\n\n# Run a one-off command in a service container.\n\ndocker compose run --rm <service> npm test​\n\n# Open a shell in a running service container.\n\ndocker compose exec <service> sh",
              "syntaxHighlightingTheme": "dracula"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 2,
              "plaintext": "Typical Development Loop"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "language": "shellscript",
              "plaintext": "# 1. Build or rebuild the dev image.\n\ndocker compose build\n\n​# 2. Start the app and dependencies.\n\ndocker compose up\n\n​# 3. Run tests in the app service.\n\ndocker compose run --rm <service> npm test\n\n​# 4. Open a shell when something needs debugging.\n\ndocker compose exec <service> sh\n\n​# 5. Stop everything when finished.\n\ndocker compose down",
              "syntaxHighlightingTheme": "dracula"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 2,
              "plaintext": "Cleanup"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "language": "shellscript",
              "plaintext": "# Remove stopped containers, unused networks, dangling images, and build cache.\n\ndocker system prune\n\n​# Remove unused images too.\n\ndocker system prune -a\n\n​# Remove unused volumes.\n\ndocker volume prune​\n\n# Show disk usage by Docker objects.\n\ndocker system df",
              "syntaxHighlightingTheme": "dracula"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 2,
              "plaintext": "Useful Patterns"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "language": "shellscript",
              "plaintext": "# Name a container so it is easier to reference.\n\ndocker run --name my-app-dev --rm -it my-app:dev\n\n​# Keep STDIN open and allocate a terminal.\n\ndocker run -it my-app:dev sh​\n\n# Automatically delete the container after it exits.\n\ndocker run --rm my-app:dev​\n\n# Publish host port 8080 to container port 3000.\n\ndocker run -p 8080:3000 my-app:dev​\n\n# Mount a read-only project directory.\n\ndocker run --rm -it -v \"$PWD:/app:ro\" -w /app my-app:dev sh​\n\n# Copy a file from a container to the host.\n\ndocker cp <container>:/path/in/container ./local-path​\n\n# Copy a file from the host to a container.\n\ndocker cp ./local-path <container>:/path/in/container",
              "syntaxHighlightingTheme": "dracula"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 2,
              "plaintext": "Placeholders"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.unorderedList",
              "children": [
                {
                  "$type": "pub.leaflet.blocks.unorderedList#listItem",
                  "content": {
                    "$type": "pub.leaflet.blocks.text",
                    "facets": [
                      {
                        "features": [
                          {
                            "$type": "pub.leaflet.richtext.facet#code"
                          }
                        ],
                        "index": {
                          "byteEnd": 11,
                          "byteStart": 0
                        }
                      },
                      {
                        "features": [
                          {
                            "$type": "pub.leaflet.richtext.facet#code"
                          }
                        ],
                        "index": {
                          "byteEnd": 48,
                          "byteStart": 39
                        }
                      }
                    ],
                    "plaintext": "<container>: container name or ID from docker ps."
                  }
                },
                {
                  "$type": "pub.leaflet.blocks.unorderedList#listItem",
                  "content": {
                    "$type": "pub.leaflet.blocks.text",
                    "facets": [
                      {
                        "features": [
                          {
                            "$type": "pub.leaflet.richtext.facet#code"
                          }
                        ],
                        "index": {
                          "byteEnd": 9,
                          "byteStart": 0
                        }
                      },
                      {
                        "features": [
                          {
                            "$type": "pub.leaflet.richtext.facet#code"
                          }
                        ],
                        "index": {
                          "byteEnd": 46,
                          "byteStart": 29
                        }
                      },
                      {
                        "features": [
                          {
                            "$type": "pub.leaflet.richtext.facet#code"
                          }
                        ],
                        "index": {
                          "byteEnd": 68,
                          "byteStart": 50
                        }
                      }
                    ],
                    "plaintext": "<service>: service name from docker compose ps or docker-compose.yml."
                  }
                },
                {
                  "$type": "pub.leaflet.blocks.unorderedList#listItem",
                  "content": {
                    "$type": "pub.leaflet.blocks.text",
                    "facets": [
                      {
                        "features": [
                          {
                            "$type": "pub.leaflet.richtext.facet#code"
                          }
                        ],
                        "index": {
                          "byteEnd": 10,
                          "byteStart": 0
                        }
                      }
                    ],
                    "plaintext": "my-app:dev: local image name and tag."
                  }
                },
                {
                  "$type": "pub.leaflet.blocks.unorderedList#listItem",
                  "content": {
                    "$type": "pub.leaflet.blocks.text",
                    "facets": [
                      {
                        "features": [
                          {
                            "$type": "pub.leaflet.richtext.facet#code"
                          }
                        ],
                        "index": {
                          "byteEnd": 9,
                          "byteStart": 0
                        }
                      }
                    ],
                    "plaintext": "3000:3000: host port to container port mapping."
                  }
                }
              ]
            }
          }
        ],
        "id": "019f0eda-f9b3-7dd1-84fa-61dd430d5bc7"
      }
    ]
  },
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreiby4uipfnamlbaybfq357ivfqdp3evg6i7wkcbllmad4jfpqfk5ka"
    },
    "mimeType": "image/webp",
    "size": 142212
  },
  "description": "A comprehensive guide to all docker commands you as a developer need to know to operate your development with containers ",
  "path": "/3mpedbh2k5k2x",
  "publishedAt": "2026-06-28T15:50:55.840Z",
  "site": "at://did:plc:eseoyklmv42do4rllmnakszt/site.standard.publication/3monzhordec23",
  "tags": [
    "docker"
  ],
  "title": "Docker Development Container Cheat Sheet"
}