computer_science:docker:docker_cheatsheet

This is an old revision of the document!


docker & docker-compose - Cheatsheet

Usefull commands for docker and docker-compose

CommandPurpose
docker-compose up -dStarts the Container and dettach (so you have your bash prompt back)
docker-compose downStops the Container
docker-compose psChecks the status of the Container
docker-exec -ti <container-name> /bin/bashOpens a Shell Prompt inside a Container (so you can troubleshoot)
docker save <image> > file.tarSaves an Image to a Tar file
Eg.: docker save nginx:latest > nginx_backup.tar
docker import file.tarLoads a Tar file as an Image
docker stop $(docker ps -a -q)Stops all Containers. You can use “rm” instead of “stop” to remove them!
docker build --tag <tag> .

To be run from the directory where “dockerfile” lives. Will greate an Image with the tag provided.

Eg.: docker build –tag tornscrapper:0.1


  • computer_science/docker/docker_cheatsheet.1604075989.txt.gz
  • Last modified: 2023/12/01 12:07
  • (external edit)