Docker Images
List all available Docker images on your system
docker images
Download a Docker image from a registry
docker pull <image_name>
Push an image to a registry
docker push <image_name>
Remove a Docker image from your system
docker rmi <image_name>
Build a Docker image from a Dockerfile
docker build -t <image_name> <path_to_Dockerfile>
Build an image from a Dockerfile located in the current directory
docker build .
Create an image from a Dockerfile and tag it
docker build -t [name]:[tag] [dockerfile-path]
Create an image from a container
docker commit [container] [new-image]
Tag an image
docker tag [image] [image]:[tag]
Show history for an image
docker history [image]
Save an image to a tar archive file
docker save [image] > [tar-file]
Remove unused images
docker image prune
Docker Containers
Create and start a new container from a Docker image
docker run <image_name>
List all running containers
docker ps
Stop a running container
docker stop <container_id>
Start a stopped container
docker start <container_id>
Restart a running container
docker restart <container_id>
Pause process in a running container
docker pause <container_id>
Unpause the process in a running container
docker unpause <container_id>
Remove a stopped container from your system
docker rm <container_id>
Send a KILL signal to stop a container
docker kill <container_id>
Execute a command inside a running container
docker exec -it <container_id> <command>
View the logs of a container
docker logs <container_id>
Run a container and remove it after it stops
docker run -rm <image>
Run an interactive process
docker run -it <image>
Docker Container Management
Create a container (without starting it)
docker create [image]
Create an interactive container with pseudo-TTY
docker create -it [image]
Rename an existing container
docker rename [container] [new-name]
Forcefully remove a container, even if it is running
docker rm -f [container]
Retrieve logs created before a specific point in time
docker logs -f --until=[interval] [container]
Update the configuration of one or more containers
docker update [container]
View port mapping for a container
docker port [container]
Show running processes in a container
docker top [container]
View live resource usage statistics for a container
docker stats [container]
Show changes to files or directories on the filesystem
docker diff [container]
Copy a local file to a directory in a container
docker cp [file-path] CONTAINER:[path]
Docker Compose
Start containers defined in a Docker Compose file
docker-compose up
Stop and remove containers defined in a Docker Compose file
docker-compose down
Build or rebuild services defined in a Docker Compose file
docker-compose build
View the logs of a specific service defined in a Docker Compose file
docker-compose logs <service_name>
Docker Networks
List all available Docker networks
docker network ls
Create a new Docker network
docker network create <network_name>
Inspect details about a Docker network
docker network inspect <network_name>
Remove a Docker network
docker network rm <network_name>
Docker Volumes
List all available Docker volumes
docker volume ls
Create a new Docker volume
docker volume create <volume_name>
Inspect details about a Docker volume
docker volume inspect <volume_name>
Remove a Docker volume
docker volume rm <volume_name>
General Management
Log in to a Docker registry
docker login
Log out of a Docker registry
docker logout
List low-level information on Docker objects
docker inspect [object]
Show the version of the local Docker installation
docker version
Display information about the system
docker info
Remove unused images, containers, and networks
docker system prune
Thank You,
I want to express my deepest gratitude to each and every one of you who has taken the time to read, engage, and support my journey as a becoming DevOps Engineer.
Feel free to reach out to me if any corrections or add-ons are required on blogs. Your feedback is always welcome & appreciated.
~ Abhisek Moharana ๐