Skip to content

Instantly share code, notes, and snippets.

@cbrunnkvist
Last active April 7, 2017 20:28
Show Gist options
  • Save cbrunnkvist/9e530918adfe61225b0f to your computer and use it in GitHub Desktop.
Save cbrunnkvist/9e530918adfe61225b0f to your computer and use it in GitHub Desktop.
Bash aliases for common invocations of `docker-machine`
# ~/.bash_profile
# `docker-machine` is commonly used for controlling a local VM which acts as your
# Docker host. What occationaly happens is that I have to(*) restart the VM, and
# subsequently re-assign the DOCKER_* environment variables in each Terminal
# window I have open. These completion-friendly aliases makes it less of a chore.
alias docker-env-eval='eval "$(docker-machine env default)"'
alias docker-machine-refresh='(docker-machine stop || docker-machine kill) ; docker-machine start; docker-env-eval'
# (*) This is commonly due to one of the folloing reasons:
# - the host is low on battery which triggers VirtualBox to suspend all running VM:s
# - `docker-machine stop default` was deliberately invoked, to save power
# - network reconfiguration events have caused bridging/forwarding to stop working
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment