Skip to content

Instantly share code, notes, and snippets.

@mdwheele
Last active January 28, 2022 14:51
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 mdwheele/297829d40b7be8222a251eb091891a26 to your computer and use it in GitHub Desktop.
Save mdwheele/297829d40b7be8222a251eb091891a26 to your computer and use it in GitHub Desktop.
# Install VirtualBox
brew install --cask virtualbox

# Install Docker (CLI), Docker Machine, and Docker Compose
brew install docker docker-machine docker-compose

# Use Docker Machine to create a VirtualBox VM that runs Docker
docker-machine create --driver virtualbox default

# Start docker-machine on boot
brew services start docker-machine

# Set up current environment to point local Docker CLI to remote
# Docker host running on VirtualBox (have to run this every terminal)
eval $(docker-machine env default)

# If you want to automatically set up `docker-machine` environment
# when you open a terminal, put the following in `~/.bash_profile`
if command -v docker-machine > /dev/null; then
  machine=$(docker-machine ls | grep "Running" | head -n 1 | awk '{ print $1 }')
  if [ "$machine" != "" ]; then
    eval "$(docker-machine env $machine)"
  fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment