aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/cheat/docker
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-09-05 07:05:07 +0200
committerneodarz <neodarz@neodarz.net>2019-09-05 07:05:07 +0200
commite0c0d4b38cde20e2300e86b69414dd9851b47456 (patch)
tree5df65243447352a9637d1f783247bfd5ccff2ef4 /dotfiles/cheat/docker
parentdc45bf89a66ec6c8cd25cf5605deb853f6984705 (diff)
downloaddotfiles_dotdrop-e0c0d4b38cde20e2300e86b69414dd9851b47456.tar.xz
dotfiles_dotdrop-e0c0d4b38cde20e2300e86b69414dd9851b47456.zip
ooo
Diffstat (limited to '')
-rw-r--r--dotfiles/cheat/docker35
1 files changed, 35 insertions, 0 deletions
diff --git a/dotfiles/cheat/docker b/dotfiles/cheat/docker
new file mode 100644
index 0000000..591eba4
--- /dev/null
+++ b/dotfiles/cheat/docker
@@ -0,0 +1,35 @@
+# Start docker daemon
+docker -d
+
+# start a container with an interactive shell
+docker run -ti <image_name> /bin/bash
+
+# "shell" into a running container (docker-1.3+)
+docker exec -ti <container_name> bash
+
+# inspect a running container
+docker inspect <container_name> (or <container_id>)
+
+# Get the process ID for a container
+# Source: https://github.com/jpetazzo/nsenter
+docker inspect --format {{.State.Pid}} <container_name_or_ID>
+
+# 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}}' <container_id> | 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