Managing Containers :
Run a Container :
docker run [OPTIONS] IMAGE [COMMAND] [ARGS]
List Running Containers :
docker ps
List All Containers (including stopped ones) :
docker ps -a
Start a Stopped Container :
docker start CONTAINER_ID
Stop a Running Container :
docker stop CONTAINER_ID
Restart a Container :
docker restart CONTAINER_ID
Remove a Container (stop and delete) :
docker rm CONTAINER_ID
Execute a Command in a Running Container :
docker exec [OPTIONS] CONTAINER_ID|NAME [COMMAND] [ARGS]
Inspect Container Details :
docker inspect CONTAINER_ID
Attach to a Running Container's STDIN, STDOUT, and STDERR :
docker attach CONTAINER_ID
Managing Images :
List Docker Images :
docker images
Pull an Image from a Registry :
docker pull IMAGE_NAME[:TAG]
Build an Image from a Dockerfile :
docker build [OPTIONS] PATH_TO_DOCKERFILE
Tag an Image :
docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
Remove an Image :
docker rmi IMAGE_ID
Search for Images on Docker Hub :
docker search IMAGE_NAME
Save an Image to a Tarball File :
docker save -o OUTPUT_FILE.tar IMAGE_NAME[:TAG]
Load an Image from a Tarball File :
docker load -i INPUT_FILE.tar
Managing Docker Volumes :
List Docker Volumes :
docker volume ls
Create a Docker Volume :
docker volume create VOLUME_NAME
Inspect a Docker Volume :
docker volume inspect VOLUME_NAME
Remove a Docker Volume :
docker volume rm VOLUME_NAME
Managing Networks :
List Docker Networks :
docker network ls
Create a Docker Network :
docker network create NETWORK_NAME
Inspect a Docker Network :
docker network inspect NETWORK_NAME
Remove a Docker Network :
docker network rm NETWORK_NAME
Managing Docker Compose :
Start Docker Compose Services :
docker-compose up [OPTIONS] [SERVICE...]
Stop Docker Compose Services :
docker-compose down [OPTIONS]
Build or Rebuild Docker Compose Services :
docker-compose build [SERVICE...]
View Docker Compose Logs :
docker-compose logs [SERVICE...]
Docker Registry and Authentication :
Login to a Docker Registry :
docker login [OPTIONS] [SERVER]
Logout from a Docker Registry :
docker logout [SERVER]Miscellaneous Commands:
Miscellaneous Commands :
View Docker Version Info :
docker version
Check Docker System Information :
docker info
Display Docker Disk Usage :
docker system df
Monitor Docker Events :
docker events [OPTIONS]
Pull and Apply Updates to Docker Swarm Services :
docker service update [OPTIONS] SERVICE
Clean Up Unused Resources (Containers, Images, Volumes, Networks) :
docker system prune
Pause a Running Container :
docker pause CONTAINER_ID
Unpause a Paused Container :
docker unpause CONTAINER_ID
Inspect Docker Daemon Logs :
docker logs docker
Docker Swarm (Container Orchestration) :
Initialize a Docker Swarm :
docker swarm init [OPTIONS]
Join a Node to a Docker Swarm :
docker swarm join [OPTIONS] HOST:PORT
List Nodes in a Docker Swarm :
docker node ls
Create a Docker Service :
docker service create [OPTIONS] IMAGE [COMMAND] [ARGS]
List Docker Services :
docker service ls
Scale a Docker Service :
docker service scale SERVICE=REPLICAS
Inspect a Docker Service :
docker service inspect SERVICE
Remove a Docker Service :
docker service rm SERVICE
Leave a Docker Swarm (Node) :
docker swarm leave [OPTIONS]
These are some of the most commonly used Docker commands for managing containers, images, volumes, networks, and Docker Swarm. Depending on your specific use case, you may need to use additional commands and options to tailor Docker to your needs.