Skip to content

Instantly share code, notes, and snippets.

@ozbe
Created May 18, 2020 13:19
Show Gist options
  • Save ozbe/2db90777153c20cb1c83009e0188e7cf to your computer and use it in GitHub Desktop.
Save ozbe/2db90777153c20cb1c83009e0188e7cf to your computer and use it in GitHub Desktop.
Docker Cheat Sheet

Docker Cheat Sheet

Delete all containers

$ docker rm $(docker ps -a -q)

Delete all images

$ docker rmi $(docker images -q)

Interactive bash

$ docker [exec|run] -it [CONTAINER_WITH_BASH] bash

Share Docker daemon with container

$ docker run --rm -it \
-v /var/run/docker.sock:/var/run/docker.sock \
[CONTAINER]

Forward ssh-agent socket (Mac

$ docker run --rm -it \
-v /run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock \
-e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" \
[CONTAINER]

See Dockerfile commands

$ docker history —no-trunc [IMAGE]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment