Last active
August 29, 2015 14:01
-
-
Save aisrael/c666baaea1a0a8eba0eb to your computer and use it in GitHub Desktop.
A bunch of useful bash functions and aliases for Docker.
This file contains 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
# Use 'docker.io' if using the official packages on Ubuntu 14.04+ | |
alias dip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'" | |
drm() { docker rm ; } | |
dri() { docker rmi ; } | |
alias dkd="docker run -d -P" | |
alias dki="docker run -t -i -P" | |
alias docker_rmi_all='docker rmi $(docker images|tail -n +2|awk '\''{print $1":"$2}'\'')' | |
##### | |
# Use to pull then immediately save and gzip an image from a repo: | |
# | |
# docker_pull_save quay.io/repository/organization/repo | |
# | |
# Will create repo.tgz in the current directory | |
function docker_pull_save() { | |
docker pull $1 | |
name=$(basename $1) | |
tgz=${basename%\:?*}.tgz | |
docker save $1 | gzip -9 > $tgz | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment