Skip to content

Instantly share code, notes, and snippets.

@ngpestelos
Forked from aisrael/docker_bashrc
Last active August 29, 2015 14:14
Show Gist options
  • Save ngpestelos/668bf697c24fd76eb9d6 to your computer and use it in GitHub Desktop.
Save ngpestelos/668bf697c24fd76eb9d6 to your computer and use it in GitHub Desktop.
# 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