skip to content
shipanjodder.com

Complete list of Docker CLI commands

Updated:

General Commands

CommandDescription
docker versionShow Docker version
docker infoDisplay system-wide information
docker helpShow help for commands

Container Management

CommandDescription
docker run -it --name mycontainer alpine shRun a container interactively
docker start <container>Start a stopped container
docker stop <container>Stop a running container
docker restart <container>Restart a container
docker pause <container>Pause a container
docker unpause <container>Resume a paused container
docker rm <container>Remove a container
docker psList running containers
docker ps -aList all containers (including stopped ones)
docker inspect Show detailed information about a container
docker logs Show logs from a container
docker top Show running processes in a container
docker statsShow real-time resource usage of containers
docker exec -it bashRun a command inside a running container
docker attach Attach to a running container’s output

Image Management

CommandDescription
docker imagesList available images
docker pull <image>Download an image from a registry
docker push <image>Upload an image to a registry
docker build -t myimage .Build an image from a Dockerfile
docker rmi <image>Remove an image
docker tag <image> myrepo/myimage:v1Tag an image for pushing to a registry
docker save -o myimage.tar <image>Save an image as a tar archive
docker load -i myimage.tarLoad an image from a tar archive
docker history <image>Show the history of an image

Network Management

CommandDescription
docker network lsList available networks
docker network create mynetworkCreate a new network
docker network inspect <network>Inspect a network
docker network rm <network>Remove a network
docker network connect <network> <container>Connect a container to a network
docker network disconnect <network> <container>Disconnect a container from a network

Volume Management

CommandDescription
docker volume lsList volumes
docker volume create myvolumeCreate a new volume
docker volume inspect <volume>Inspect a volume
docker volume rm <volume>Remove a volume

Container Cleanup

CommandDescription
docker system prune -aRemove all unused containers, networks, images, and volumes
docker rm $(docker ps -aq)Remove all stopped containers
docker rmi $(docker images -q)Remove all images
docker volume rm $(docker volume ls -q)Remove all volumes