Show Menu

This is a cheat sheet for commands used in Docker.


sudo apt-get install docker
Install Docker on Ubuntu
docker images
Shows all images present on local
docker search <im­age­_na­me>
Finds image on docker-hub
docker pull <im­age­_na­me>
Downloads image from docker-hub to local
docker run -it --name <co­nta­ine­r_n­ame> <im­age­_na­me> /bin/bash
To give a name to the container and run
systemctl status docker
To check whether docker is running
systemctl restart docker
To restart docker
systemctl start docker
Starts docker
docker ps
To see running containers
docker ps -a
To see all containers
docker attach <co­ntainer name>
To go inside the container
docker stop <co­ntainer name>
stops given container
docker rm <co­ntainer name>
deletes given container
exits container
docker build -t <im­age­_na­me>
Creates image out of a docker file
docker exec -it <co­ntainer name> /bin/bash
Executes container

Docker Volume

Docker volume ls
Shows all created docker volumes
docker volume create <vo­lum­e_n­ame>
Creates Docker Volume
Docker volume rm <volume name>
Deletes Docker Volume
docker volume prune
Removes all unused volumes
docker volume inspect <volume name>
Gives volume details
docker container inspect <co­ntainer name>
Gives container details


docker­-co­mpose up
Runs docker­-co­mpose file and runs container
docker­-co­mpose down
Stops running container built from compose file
docker­-co­mpose up -d
Starts containers in background and keeps them running


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Docker cheat sheet Cheat Sheet

          More Cheat Sheets by RohitKadolkar

          Linux & Git Cheat Sheet