Docker Commands Cheat Sheet
Command                                                 Description
docker --version                                Check Docker version.
docker info                                     Display Docker system-wide information.
docker images                                   List all locally available images.
docker pull <image>                             Download an image from Docker Hub.
docker rmi <image>                              Remove a specific image.
docker image prune                              Remove unused images.
docker ps                                       List running containers.
docker ps -a                                    List all containers, including stopped ones.
docker start <container>                        Start a stopped container.
docker stop <container>                         Stop a running container.
docker restart <container>                      Restart a container.
docker rm <container>                           Remove a container.
docker logs <container>                         Fetch logs of a container.
docker run <image>                              Run a container from an image.
docker run -it <image>                          Run a container in interactive mode.
docker run -d <image>                           Run a container in detached mode.
docker run --name <name> <image>                Run a container with a custom name.
docker network ls                               List all Docker networks.
docker network create <name>                    Create a new network.
docker network connect <network> <container>    Connect a container to a network.
docker network disconnect <network> <container> Disconnect a container from a network.
docker volume ls                                List all Docker volumes.
docker volume create <name>                     Create a volume.
docker volume rm <name>                         Remove a volume.
docker run -v <volume>:/path/in/container <image>Mount a volume to a container.
docker-compose up                                Start services defined in a `docker-compose.yml` file.
docker-compose down                              Stop and remove services and networks.
docker-compose ps                                List all services in a Compose application.
docker build -t <tag> <path>                     Build an image from a `Dockerfile`.
docker history <image>                           View the history of an image.
docker exec -it <container> <command>            Execute a command inside a running container.
docker exec -it <container> bash                 Access a container's shell interactively.
docker system df                                 View Docker disk usage.
docker system prune                              Remove unused data (stopped containers, unused images, etc.).
docker tag <image> <repository>:<tag>            Tag an image for a repository.
docker push <repository>:<tag>                   Push an image to a repository.
docker inspect <resource>                        Get detailed information about a resource (container/image/network).
docker stats                                     View real-time resource usage of containers.
docker save -o <file> <image>                    Save an image to a tar file.
docker load -i <file>                            Load an image from a tar file.
docker top <container>                           Display processes running in a container.
docker events                                    View real-time Docker events.