Printing and PDF export are disabled for this content. View it online at Full Stack Learning Simplified.
Docker Common Commandsπ± Beginner
A handful of commands cover almost all daily container work β running, inspecting, debugging, and cleaning up.
Containers
| Command | Does |
|---|---|
docker ps / docker ps -a | list running / all containers |
docker run <image> | create and start a container |
docker stop <name> / start | stop / restart a container |
docker rm <name> | remove a stopped container |
docker logs -f <name> | view (and follow) its logs |
docker exec -it <name> bash | open a shell inside it |
Images
| Command | Does |
|---|---|
docker images | list local images |
docker pull <image> | download an image |
docker build -t name . | build an image from a Dockerfile |
docker rmi <image> | remove an image |
Inspect and debug
bash
docker logs -f web # stream logs
docker exec -it web sh # shell inside a running container
docker inspect web # full JSON details (config, network, mounts)
docker stats # live CPU/memory usageCleaning up
bash
docker system df # see disk usage
docker container prune # remove all stopped containers
docker image prune -a # remove unused images
docker system prune -a # remove everything unused (careful!)Warning:
docker system prune -a deletes all stopped containers, unused networks, and unused images β it can free a lot of space but will re-download images later. Run it deliberately, not on a whim.Tip:
docker exec -it <name> sh (or bash) is your go-to for debugging β it drops you into a shell inside the running container to inspect files, environment, and processes. Use docker logs -f to watch output in real time.Docker Container Takeaway: Docker containers isolate application runtimes using Linux kernel namespaces (for processes) and control groups (cgroups for resources).
Free preview. Sign in and subscribe to unlock all 982 lessons across 31 courses.
Free preview Β· Β© 2026 Full Stack Learning Simplified