Cheatography
https://cheatography.com
This is a cheat sheet for commands used in Docker.
Docker
sudo apt-get install docker |
Install Docker on Ubuntu |
docker images |
Shows all images present on local |
docker search <image_name> |
Finds image on docker-hub |
docker pull <image_name> |
Downloads image from docker-hub to local |
docker run -it --name <container_name> <image_name> /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 <container name> |
To go inside the container |
docker stop <container name> |
stops given container |
docker rm <container name> |
deletes given container |
exit |
exits container |
docker build -t <image_name> |
Creates image out of a docker file |
docker exec -it <container name> /bin/bash |
Executes container |
|
|
Docker Volume
Docker volume ls |
Shows all created docker volumes |
docker volume create <volume_name> |
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 <container name> |
Gives container details |
docker-compose
docker-compose up |
Runs docker-compose file and runs container |
docker-compose down |
Stops running container built from compose file |
docker-compose up -d |
Starts containers in background and keeps them running |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by RohitKadolkar