Last active
August 29, 2015 14:05
-
-
Save BenjaminHerbert/0ce28721193efe8e7c8a to your computer and use it in GitHub Desktop.
docker shortcuts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From http://kartar.net/2014/03/some-useful-docker-bash-functions-and-aliases/ | |
# Docker container IP | |
alias dip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'" | |
#Removing containers | |
drm() { docker rm $(docker ps -q -a); } | |
#Removing images | |
dri() { docker rmi $(docker images -q); } | |
#Run a daemonized container with port mapping | |
alias dkd="docker run -d -P" | |
#Run an interactive container with port mapping | |
alias dki="docker run -t -i -P" | |
# build a container and make it a tag - assumes a Dockerfile in the current directory. | |
db() { docker build -t="$1" .; } | |
# remove dangling images (dangling=="untagged images, that are the leaves of the images tree (not intermediary layers)" - https://docs.docker.com/reference/commandline/cli/#images) | |
docker rmi $(docker images -q --filter "dangling=true") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment