# 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
}