Skip to content

Instantly share code, notes, and snippets.

@zulhfreelancer
Last active October 29, 2020 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zulhfreelancer/27020de0c53931104fbcb37bc4288d8b to your computer and use it in GitHub Desktop.
Save zulhfreelancer/27020de0c53931104fbcb37bc4288d8b to your computer and use it in GitHub Desktop.
Docker Machine — bash function to start Docker Engine (daemon) in VirtualBox and sets environment variables for Docker Client (running on host)
# If Docker Engine in Virtualbox is running, set Docker client environment variables
if [ "$(docker-machine status default)" = "Running" ]
then
eval $(docker-machine env)
fi
# Start Docker Engine function
docker-engine-start () { # <-- if that's too long, you can go with just `des`
echo "================================"
echo "Starting Docker Machine..."
echo "================================"
docker-machine start
echo "================================"
echo "Setting env for Docker Client..."
echo "================================"
eval $(docker-machine env)
echo "Done!"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment