mirror of
https://github.com/Erreur32/cheat.git
synced 2024-11-16 17:08:35 +01:00
Add cheat for docker
This commit is contained in:
parent
7eb405dcf8
commit
77429d9ccc
1 changed files with 26 additions and 0 deletions
26
cheat/cheatsheets/docker
Normal file
26
cheat/cheatsheets/docker
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# Start docker daemon
|
||||||
|
docker -d
|
||||||
|
|
||||||
|
# start a container with an interactive shell
|
||||||
|
docker run -ti <image_name> /bin/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
|
||||||
|
|
||||||
|
# list currently running containers
|
||||||
|
docker ps
|
||||||
|
|
||||||
|
# list all containers
|
||||||
|
docker ps -a
|
||||||
|
|
||||||
|
# list all images
|
||||||
|
docker images
|
Loading…
Reference in a new issue