This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision |
computer_science:docker:docker_cheatsheet [2020/08/27 19:41] – carlossousa | computer_science:docker:docker_cheatsheet [2023/12/11 21:30] (current) – carlossousa |
---|
|docker-exec -ti <container-name> /bin/bash|Opens a Shell Prompt inside a Container (so you can troubleshoot)| | |docker-exec -ti <container-name> /bin/bash|Opens a Shell Prompt inside a Container (so you can troubleshoot)| |
|docker save <image> > file.tar|Saves an Image to a Tar file \\ Eg.: docker save nginx:latest > nginx_backup.tar| | |docker save <image> > file.tar|Saves an Image to a Tar file \\ Eg.: docker save nginx:latest > nginx_backup.tar| |
|docker import file.tar|Loads a Tar file as an Image| | |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 stop $(docker ps -a -q)|Stops all Containers. You can use "rm" instead of "stop" to remove them!| |
| |<code bash> |
| docker build --tag <tag> . |
| |
\\ | |
| </code> |To be run from the directory where "dockerfile" lives. Will create an Image with the tag provided. Eg.: docker build –tag tornscrapper:0.1 | |
| |<code> |
| docker images -a | grep none | awk '{ print $3; }' | xargs docker rmi |
| |
| </code> |Delete dangling images and / or images that have a "none" tag. \\ Might be helpful if "docker image prune" doesn't remove those.| |
| |
| |