A categorized reference for essential Docker CLI commands. Search and copy commands for container management, image builds, Compose, networking, volumes, registry, and system operations.
Click a category button to narrow down commands by container, image, Compose, and more.
Type a keyword in the search box to search across command names, descriptions, options, and examples in real time.
Click the copy button on a card to copy the command to your clipboard.
docker run -d -p 8080:80 nginxStart Nginx in the background, accessible on port 8080docker run --rm -it ubuntu bashStart an interactive Ubuntu container that removes itself on exitdocker run -d --name myapp -e NODE_ENV=production -p 3000:3000 node:20Start a named Node.js app in production modedocker psList running containersdocker ps -aShow all containers including stopped onesdocker ps -q --filter status=exitedGet IDs of stopped containers onlydocker stop myappStop a container by namedocker stop $(docker ps -q)Stop all running containersdocker start myappStart a stopped containerdocker start -ai myappStart a container in interactive modedocker rm myappRemove a stopped containerdocker rm -f $(docker ps -aq)Force remove all containersdocker exec -it myapp bashStart a bash shell inside the containerdocker exec myapp cat /etc/hostsDisplay a file inside the containerdocker logs -f myappFollow log output in real timedocker logs --tail 100 myappShow the last 100 lines of logsdocker logs --since 1h myappShow logs from the past hourdocker inspect myappShow detailed information about a containerdocker inspect -f '{{.NetworkSettings.IPAddress}}' myappGet only the container's IP addressdocker cp myapp:/app/logs ./logsCopy logs from the container to the hostdocker cp ./config.json myapp:/app/Copy a config file from the host to the containerdocker statsShow resource usage for all containersdocker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}'Print CPU and memory usage once in table formatdocker build -t myapp:latest .Build an image from the current directorydocker build -t myapp:v1 -f Dockerfile.prod .Build using a production Dockerfiledocker build --no-cache -t myapp:latest .Clean build without cachedocker imagesList local imagesdocker images --filter dangling=trueShow untagged (dangling) imagesdocker rmi myapp:latestRemove a specific imagedocker rmi $(docker images -q --filter dangling=true)Remove all dangling images at oncedocker tag myapp:latest myapp:v1.0Add a version tagdocker tag myapp:latest registry.example.com/myapp:latestTag an image for a private registrydocker pull nginx:latestPull the latest Nginx imagedocker pull --platform linux/arm64 node:20Pull Node.js 20 for ARM64docker push myuser/myapp:latestPush an image to Docker Hubdocker push registry.example.com/myapp:v1.0Push to a private registrydocker save -o myapp.tar myapp:latestSave an image to a tar filedocker load -i myapp.tarLoad an image from a tar filedocker compose up -dStart all services in the backgrounddocker compose up -d --buildBuild and then start in the backgrounddocker compose up -d --scale web=3Start the web service with 3 instancesdocker compose downStop services and remove containersdocker compose down -vRemove everything including volumesdocker compose buildBuild images for all servicesdocker compose build --no-cache webBuild the web service without cachedocker compose psList the status of all servicesdocker compose logs -f webFollow log output from the web servicedocker compose logs --tail 50Show the last 50 lines from all servicesdocker compose exec web bashStart bash in the web service containerdocker compose exec db psql -U postgresConnect to PostgreSQL in the db servicedocker compose run --rm web npm testRun tests in the web service and remove the container afterwarddocker compose run --rm db pg_dump -U postgres mydb > backup.sqlCreate a database backupdocker compose configDisplay the merged configurationdocker compose config --servicesList all defined service namesdocker network create mynetCreate a bridge networkdocker network create --subnet 172.20.0.0/16 mynetCreate a network with a specific subnetdocker network lsList all networksdocker network inspect mynetShow detailed information about a networkdocker network connect mynet myappConnect a container to a networkdocker network rm mynetRemove a networkdocker volume create mydataCreate a volumedocker volume lsList all volumesdocker volume inspect mydataShow detailed information about a volumedocker volume rm mydataRemove a volumedocker volume prune -fRemove all unused volumes without confirmationdocker loginLog in to Docker Hubdocker login registry.example.comLog in to a private registrydocker logoutLog out from Docker Hubdocker search nginxSearch for Nginx imagesdocker search --filter is-official=true nodeSearch for official Node.js imagesdocker manifest inspect nginx:latestDisplay the manifest for the Nginx imagedocker system dfShow a summary of disk usagedocker system df -vShow detailed disk usagedocker system prune -fRemove unused resources without confirmationdocker system prune -a --volumes -fRemove all unused resources including images and volumesdocker infoDisplay detailed Docker environment informationdocker versionDisplay version informationdocker version --format '{{.Server.Version}}'Show only the server versiondocker context lsList all registered contextsdocker buildx build --platform linux/amd64,linux/arm64 -t myapp:latest --push .Build for both AMD64 and ARM64 and pushdocker buildx build --load -t myapp:latest .Build with BuildKit and load locallyThe Docker Commands Reference is a tool that organizes essential Docker CLI commands by category. Quickly look up commands for container lifecycle management, image builds and distribution, multi-container management with Docker Compose, and network and volume configuration — all with search and copy functionality.
docker compose (with a space) is Compose V2, integrated into the Docker CLI v2. docker-compose (with a hyphen) is the older standalone binary (V1). Compose V2 is now the recommended approach.
Run docker system prune -a --volumes -f to remove stopped containers, unused networks, untagged images, and unused volumes all at once. Be cautious with -f (skip confirmation) in production environments.
Use docker run for single containers. For multiple containers working together (app + DB + cache, etc.), use docker compose up and manage configuration in a docker-compose.yml file.
Use docker buildx build --platform linux/amd64,linux/arm64. With BuildKit enabled, it's common to combine this with the --push option to push directly to a registry.
Use docker logs -f <container-name> to follow logs in real time. For Docker Compose, use docker compose logs -f <service-name>. You can limit the number of lines with the --tail option.