Docker Cheat-Sheet

Docker Cheat-Sheet

Working with Containers:

CommandDescription
docker run <image>Creates and starts a new container from the specified image
docker start <container>Starts a stopped container
docker stop <container>Stops a running container
docker rm <container>Deletes a stopped container
docker psLists all running containers
docker ps -aLists all containers (running and stopped)
docker logs <container>Displays the logs for a container
docker exec -it <container> <command>Executes a command inside a running container

Working with Images:

CommandDescription
docker pull <image>Downloads an image from a registry
docker build <directory>Builds an image from a Dockerfile
docker push <image>Uploads an image to a registry
docker imagesLists all locally available images
docker rmi <image>Deletes a locally available image

Working with Volumes:

CommandDescription
docker volume create <name>Creates a new volume
docker volume lsLists all available volumes
docker volume rm <name>Deletes a volume

Working with Networks:

CommandDescription
docker network create <name>Creates a new network
docker network lsLists all available networks
docker network rm <name>Deletes a network

System Administration:

CommandDescription
docker versionDisplays the Docker version
docker infoDisplays system-wide information about Docker
docker system pruneDeletes all stopped containers, unused networks, and dangling images
docker system dfShows the disk usage of Docker components