DEV Community

Cover image for 50 Docker Commands That Will Make You Unstoppable in 2026 ๐Ÿณโšก
Padhmeni Priya R R
Padhmeni Priya R R

Posted on

50 Docker Commands That Will Make You Unstoppable in 2026 ๐Ÿณโšก

You've googled "docker command to remove stopped containers" at 2 AM. This post ends that cycle โ€” with diagrams, not just a wall of text โ€” for beginners and pros alike.

๐Ÿง  Core Concepts

Term What it is
Image Read-only blueprint of your app โ€” the recipe.
Container A running instance of an image โ€” the cooked dish.
Registry Remote image storage, e.g. Docker Hub.
Volume Persistent storage that survives container deletion.
Network Virtual wire letting containers talk by name.

Try this now: docker run -d -p 8080:80 nginx, then open localhost:8080. That's a real server running in a container.

๐Ÿ“ฆ Images

๐ŸŸข Beginner ๐Ÿ”ต Intermediate ๐ŸŸฃ Advanced

Command Purpose Docs
๐ŸŸข docker build -t app . Builds an image from a Dockerfile build
๐Ÿ”ต docker build --no-cache Rebuilds ignoring cached layers build
๐ŸŸข docker images Lists all local images ls
๐ŸŸข docker rmi app Deletes a local image rm
๐Ÿ”ต docker image prune Removes dangling, untagged images prune
๐Ÿ”ต docker image prune -a Removes all unused images prune
๐ŸŸข docker pull nginx Downloads an image from a registry pull
๐Ÿ”ต docker push user/app Uploads an image to a registry push
๐ŸŸข docker tag app user/app Renames or versions an image tag
๐ŸŸฃ docker inspect app Shows full image metadata as JSON inspect

Further reading: Docker cheat sheet ยท Collabnix ยท HN

๐Ÿš€ Containers

Command Purpose Docs
๐ŸŸข docker run nginx Creates and starts a container run
๐ŸŸข docker run -d nginx Runs a container in the background run
๐ŸŸข docker run --name web nginx Runs a container with a custom name run
๐ŸŸข docker run -p 8080:80 nginx Maps a host port to a container run
๐Ÿ”ต docker run -it ubuntu bash Runs a container with a live shell run
๐ŸŸข docker ps Lists running containers ls
๐ŸŸข docker ps -a Lists all containers, including stopped ls
๐ŸŸข docker stop web Gracefully stops a container stop
๐ŸŸข docker start web Restarts a stopped container start
๐ŸŸข docker restart web Stops and starts a container again restart
๐ŸŸข docker rm web Deletes a stopped container rm
๐Ÿ”ต docker rm -f web Force-removes a running container rm
๐Ÿ”ต docker exec -it web bash Opens a shell inside a running container exec
๐ŸŸข docker logs web Shows a container's log output logs
๐ŸŸข docker logs -f web Streams logs live logs

Further reading: Running containers ยท Collabnix ยท HN

๐Ÿงน Cleanup

Command Purpose Docs
๐Ÿ”ต docker container prune Removes all stopped containers prune
๐Ÿ”ต docker network prune Removes unused networks prune
๐ŸŸฃ docker volume prune Removes unused volumes โ€” check data first prune
๐ŸŸฃ docker system prune -a Removes all unused images/containers/networks prune
๐ŸŸฃ docker system prune -a --volumes Same, plus wipes volumes โ€” irreversible prune
๐Ÿ”ต docker system df Shows Docker's disk usage df
๐Ÿ”ต docker system df -v Shows detailed per-item disk usage df
๐ŸŸฃ docker kill $(docker ps -q) Force-stops every running container kill

Further reading: System prune docs ยท Collabnix ยท HN

๐ŸŒ Networking & Volumes

Containers on the same custom network resolve each other by name โ€” no hardcoded IPs.

Command Purpose Docs
๐ŸŸข docker network ls Lists all networks ls
๐Ÿ”ต docker network create my-net Creates a custom bridge network create
๐Ÿ”ต docker network connect my-net web Attaches a container to a network connect
๐ŸŸฃ docker network inspect my-net Shows subnet, driver, connected containers inspect
๐ŸŸข docker volume create data Creates a persistent volume create
๐ŸŸข docker volume ls Lists all volumes ls
๐Ÿ”ต docker run -v data:/app nginx Mounts a named volume run
๐Ÿ”ต docker run -v $(pwd):/app nginx Bind-mounts a local folder run

Further reading: Networking overview ยท Collabnix ยท HN

๐Ÿงฉ Compose

Compose replaces five docker run commands with one YAML file.

Command Purpose Docs
๐ŸŸข docker compose up Starts all services in docker-compose.yml up
๐ŸŸข docker compose up -d Starts services in the background up
๐ŸŸข docker compose down Stops and removes Compose containers down
๐Ÿ”ต docker compose down -v Same, plus deletes named volumes down
๐ŸŸข docker compose logs -f Streams logs from all services logs
๐Ÿ”ต docker compose up --build Rebuilds images before starting up

Further reading: Compose CLI reference ยท Collabnix ยท HN

๐Ÿ› ๏ธ Debugging

Command Purpose Docs
๐Ÿ”ต docker stats Shows live CPU/memory usage per container stats
๐ŸŸข docker cp web:/app/f.json . Copies a file between host and container cp
๐ŸŸฃ docker history app Shows every layer used to build an image history

Further reading: Docker CLI reference ยท Collabnix ยท HN

โœ… Key Takeaways

  • Images are blueprints, containers are running instances โ€” everything traces back to this.
  • docker run is your most-used command โ€” master -d -p -v --name -it first.
  • Cleanup isn't optional. Make docker system prune -a --volumes a habit.
  • Custom networks give free DNS โ€” containers resolve each other by name.
  • Compose replaces a wall of docker run commands with one YAML file.
  • docker logs, exec, and inspect are your debugging trio.
  • Bookmark this post โ€” you don't need to memorize all 50.

๐Ÿ’ฌ What Should I Cover Next?

Vote in the comments: Compose deep dive ยท Dockerfile best practices ยท Advanced networking ยท Docker security ยท Docker + Kubernetes. Tell me which and it's next.


Tags: docker devops containers beginners
Hashtags: #Docker #DevOps #CloudNative #100DaysOfCode #PlatformEngineering #Kubernetes #BuildInPublic
Mentions: @Docker @dev_community @github @DockerCon

โœ๏ธ About the Author

Padhmeni Priya R R โ€” Bioinformatics Master's grad working as a research scientist on cutting-edge variant analysis tools, endlessly curious about technology and AI-driven innovation.
๐Ÿ”— linkedin.com/in/padhmeni

Drop a ๐Ÿณ if this saved you a search, and tell me what to cover next.

Top comments (0)