====== docker & docker-compose - Cheatsheet ====== Usefull commands for docker and docker-compose ^Command^Purpose| |docker-compose up -d|Starts the Container and dettach (so you have your bash prompt back)| |docker-compose down|Stops the Container| |docker-compose ps|Checks the status of the Container| |docker-exec -ti /bin/bash|Opens a Shell Prompt inside a Container (so you can troubleshoot)| |docker save > file.tar|Saves an Image to a Tar file \\ Eg.: docker save nginx:latest > nginx_backup.tar| |docker load < file.tar|Loads 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 . |To be run from the directory where "dockerfile" lives. Will create an Image with the tag provided. Eg.: docker build –tag tornscrapper:0.1 | | docker images -a | grep none | awk '{ print $3; }' | xargs docker rmi |Delete dangling images and / or images that have a "none" tag. \\ Might be helpful if "docker image prune" doesn't remove those.|