Skip to content

Instantly share code, notes, and snippets.

@toricls
Created September 8, 2015 06:32
Show Gist options
  • Save toricls/14059a108cea78ae28bb to your computer and use it in GitHub Desktop.
Save toricls/14059a108cea78ae28bb to your computer and use it in GitHub Desktop.
Use Docker Toolbox with simple commands like boot2docker
#
# Add code below at the bottom of your zshrc/bashrc.
# You can use Docker Toolbox with simple commands like boot2docker.
# Notice: This script can handle only `default` machine.
#
# e.g.
# b2d start
# b2d ssh
# b2d stop
#
# Set env values for new shell
if [ "`docker-machine status default`" = "Running" ]; then
eval "$(docker-machine env default)"
fi
# docker-machine command wrapper
b2d () {
if [ $# != 1 ]; then
echo "Phew, We need a command to run. See `docker-machine help`."
else
docker-machine $1 default
if [ "`docker-machine status default`" = "Running" ]; then
eval "$(docker-machine env default)"
fi
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment