From af15554a8eec5f373c6bbd534828c2ef62e8c8e7 Mon Sep 17 00:00:00 2001 From: neodarz Date: Fri, 21 Dec 2018 18:21:11 +0100 Subject: Add docker cheat --- cheat/.cheat/docker | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 cheat/.cheat/docker diff --git a/cheat/.cheat/docker b/cheat/.cheat/docker new file mode 100644 index 0000000..591eba4 --- /dev/null +++ b/cheat/.cheat/docker @@ -0,0 +1,35 @@ +# Start docker daemon +docker -d + +# start a container with an interactive shell +docker run -ti /bin/bash + +# "shell" into a running container (docker-1.3+) +docker exec -ti bash + +# inspect a running container +docker inspect (or ) + +# Get the process ID for a container +# Source: https://github.com/jpetazzo/nsenter +docker inspect --format {{.State.Pid}} + +# List the current mounted volumes for a container (and pretty print) +# Source: +# http://nathanleclaire.com/blog/2014/07/12/10-docker-tips-and-tricks-that-will-make-you-sing-a-whale-song-of-joy/ +docker inspect --format='{{json .Volumes}}' | python -mjson.tool + +# Copy files/folders between a container and your host +docker cp foo.txt mycontainer:/foo.txt + +# list currently running containers +docker ps + +# list all containers +docker ps -a + +# list all images +docker images + +IF: dpkg: error: error creating new backup file '/var/lib/dpkg/status-old': Invalid cross-device link E: Sub-process /usr/bin/dpkg returned an error code (2) +DO: echo N | sudo tee /sys/module/overlay/parameters/metacopy -- cgit v1.2.1