From 77429d9ccc810d18f744a08539dfc1fc6895401b Mon Sep 17 00:00:00 2001 From: Amit Saha Date: Thu, 23 Oct 2014 14:48:25 +1000 Subject: [PATCH] Add cheat for docker --- cheat/cheatsheets/docker | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 cheat/cheatsheets/docker diff --git a/cheat/cheatsheets/docker b/cheat/cheatsheets/docker new file mode 100644 index 0000000..8dc66c5 --- /dev/null +++ b/cheat/cheatsheets/docker @@ -0,0 +1,26 @@ +# Start docker daemon +docker -d + +# start a container with an interactive shell +docker run -ti /bin/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 + +# list currently running containers +docker ps + +# list all containers +docker ps -a + +# list all images +docker images \ No newline at end of file