Images
docker imagesLists locally stored images.
docker pull IMAGE:TAGDownloads an image from a registry without running it.
docker rmi IMAGE_IDDeletes a local image. Fails if a container still references it — remove the container first.
docker tag SOURCE_IMAGE TARGET_IMAGECreates an additional tag for an image — the usual step before pushing to a registry under a versioned or environment-specific name.
docker push TARGET_IMAGEUploads a tagged image to its registry.
Build
docker build -t app .Builds an image from the Dockerfile in the current directory, tagged app:latest.
docker build -t app:1.2.0 -f Dockerfile.prod .Builds with an explicit tag and a non-default Dockerfile path.
docker build --no-cache -t app .Builds without using any cached layers — for confirming a build is reproducible, or ruling out a stale cache as the cause of a bug.
Containers
docker psLists running containers.
docker ps -aLists all containers, including stopped ones.
docker run -d -p 8080:80 appRuns a container in the background, mapping host port 8080 to container port 80.
docker run -it --rm app /bin/shRuns a container interactively and removes it automatically on exit — the standard pattern for a throwaway debugging shell.
docker stop CONTAINER_IDSends SIGTERM and waits for graceful shutdown before killing the container.
docker rm CONTAINER_IDRemoves a stopped container and its writable layer permanently. Add -f to stop and remove in one step.
docker restart CONTAINER_IDStops and starts a container in place, keeping its configuration and name.
Exec & Logs
docker exec -it CONTAINER_ID bashOpens an interactive shell inside a running container.
docker logs CONTAINER_IDPrints a container's stdout/stderr output.
docker logs -f CONTAINER_IDStreams logs live.
docker inspect CONTAINER_IDDumps full container configuration as JSON — mounts, network settings, env vars, resource limits.
docker statsShows live CPU, memory, network and I/O usage per running container.
Networks
docker network lsLists Docker networks.
docker network create my-networkCreates a user-defined bridge network — containers on it can resolve each other by container name, unlike the default bridge.
docker network inspect my-networkShows which containers are attached to a network and their IPs.
Volumes
docker volume lsLists named volumes.
docker volume create my-dataCreates a named volume, managed by Docker and independent of any single container's lifecycle.
docker run -v my-data:/var/lib/data appMounts a named volume into a container at the given path.
Registry
docker loginAuthenticates against a registry (Docker Hub by default, or pass a registry hostname).
docker logoutRemoves cached credentials for a registry.
Cleanup
docker system pruneRemoves stopped containers, unused networks, and dangling (untagged) images. Prompts for confirmation.
docker system prune -a --volumesAlso removes every image not used by a running container, and every unused volume — including named volumes holding data nothing is currently using. Confirm nothing important is stored only in an idle volume first.
docker container pruneRemoves all stopped containers only.
Docker Compose
docker compose up -dStarts every service defined in compose.yaml in the background.
docker compose downStops and removes containers and networks created by up. Add -v to also remove named volumes.
docker compose logs -f SERVICE_NAMEStreams logs for one service in the compose project.
docker compose psLists the containers for the current compose project and their status.
docker compose exec SERVICE_NAME shOpens a shell in a running service container, addressed by its compose service name rather than a container ID.
docker compose buildRebuilds images for services with a build: block, without starting them.
See the Docker Troubleshooting tab for containers that exit immediately, won't build, or can't reach the network.