docker pull <image>[:tag]
Downloads an image from a registry
Practical example
docker pull nginx:latest
docker pull node:20-alpine
developer reference
A practical Docker reference with search, one-click copy and printable PDF output.
35 commands visible
docker pull <image>[:tag]
Downloads an image from a registry
docker pull nginx:latest
docker pull node:20-alpine
docker build -t <name:tag> .
Builds an image from the Dockerfile in the current directory
docker build -t myapp:1.0 .
# without cache
docker build --no-cache -t myapp:1.0 .
docker images
Lists local images
docker images
docker images -a # include intermediate images
docker tag <src> <dst>
Creates another tag/reference for an existing image
docker tag myapp:1.0 myuser/myapp:latest
docker push <image>
Pushes an image to a registry
docker push myuser/myapp:latest
docker rmi <image>
Removes a local image
Removes a local image reference. --force can remove tags used by containers.
docker rmi myapp:1.0
docker rmi $(docker images -q) # all images
docker image prune -a
Removes images unused by any container
Removes every image not referenced by a container, including tagged images.
docker image prune -a
docker save -o <file.tar> <image>
Exports an image to a tar file
docker save -o myapp.tar myapp:1.0
docker run -d --name <n> <image>
Starts a container in the background
Docker port already allocated: find and resolve the conflict →
# detached, mapped port
docker run -d --name web -p 8080:80 nginx
# with a volume
docker run -d -v /host/path:/app -e NODE_ENV=prod node:20
docker run -it <image> <cmd>
Starts an interactive container with a shell
Docker port already allocated: find and resolve the conflict →
docker run -it ubuntu bash
docker run --rm -it node:20 sh
docker ps
Lists running containers (-a for all)
Docker port already allocated: find and resolve the conflict →
docker ps
docker ps -a
docker ps --format "table {{.Names}}\t{{.Status}}"
docker exec -it <name> <cmd>
Runs a command inside a running container
docker exec -it web bash
docker exec web ls /app
docker logs <name>
Shows container logs
docker logs web
docker logs -f web # follow logs
docker logs --tail 100 web
docker stop <name>
Stops a container cleanly
docker stop web
docker stop $(docker ps -q) # all containers
docker rm <name>
Removes a stopped container
Deletes the container and its writable layer. --force also terminates a running container.
docker rm web
docker rm $(docker ps -aq) # all containers
docker inspect <name>
JSON with all container details
docker inspect web
docker inspect -f '{{.NetworkSettings.IPAddress}}' web
docker cp <src> <name>:<dst>
Copies files between host and container
docker cp ./config.json web:/app/config.json
docker cp web:/app/logs ./logs
docker stats
Real-time CPU/RAM monitor
docker stats
docker stats web --no-stream
docker volume create <name>
Creates a named volume
docker volume create mydata
docker volume ls
docker volume inspect <name>
Volume details, including mountpoint
docker volume inspect mydata
docker volume rm <name>
Removes a volume
Deletes the volume and its persisted data. Verify backups first.
docker volume rm mydata
docker volume prune # remove all unused images
docker network ls
Lists Docker networks
docker network ls
docker network create <name>
Creates a custom bridge network
docker network create mynet
docker network create --driver overlay myswarm
docker network connect <net> <container>
Connects a container to a network
docker network connect mynet web
docker network inspect <name>
Network details and connected containers
docker network inspect mynet
docker compose up -d
Starts all services in the background
Docker port already allocated: find and resolve the conflict →
docker compose up -d
docker compose up -d --build # force a rebuild
docker compose down
Stops and removes containers and networks
The -v variant deletes declared named volumes and attached anonymous volumes, including their data. External volumes remain.
docker compose down
docker compose down -v # also DELETE volumes and their data
docker compose logs -f
Shows logs for all services
docker compose logs -f
docker compose logs -f web # web service only
docker compose exec <svc> <cmd>
Runs a command in a Compose service
docker compose exec web sh
docker compose exec db psql -U postgres
docker compose ps
Status of Compose services
docker compose ps
docker compose pull
Updates service images
docker compose pull
docker compose pull web
docker system prune -a
Removes stopped containers, unused networks, unused images and build cache; volumes require --volumes
Deletes stopped containers, unused networks, unused images and build cache. --volumes also deletes unused anonymous volumes. There is no dry-run option.
# inspect disk usage; not a dry run
docker system df
docker system prune -a --volumes # include anonymous volumes
docker system df
Space used by images, containers and volumes
docker system df
docker system df -v # detailed usage
docker info
Docker daemon info: version and resources
docker info
By default it removes service containers and networks, not volumes. The -v option removes declared named and attached anonymous volumes and their data; external volumes are not removed.
Use Print PDF. The printable version includes all commands and practical examples, including sections hidden by a search.
Yes. Serve the static files with a local HTTP server. Search, filters and copying run in your browser; the Regex tester requires a worker-enabled HTTP context.