Install Docker Toolbox on a Mac via command line

Deprecation Warning

Docker Toolbox and Docker Machine have both been deprecated. Docker Desktop is the officially recommended replacement.

Original Answer

I found that Docker Toolbox is available via brew/cask

# Install Homebrew
ruby -e "$(curl -fsSL"
# Install Cask
brew install caskroom/cask/brew-cask
# Install docker toolbox
brew cask install docker-toolbox

Once Docker Toolbox is installed you can setup your docker environment using the Get started with Docker Machine guide.

# create the docker machine
docker-machine create --driver "virtualbox" myBoxName

# start the docker machine
docker-machine start myBoxName

# this command allows the docker commands to be used in the terminal
eval "$(docker-machine env myBoxName)"

# at this point can run any "docker" or "docker-compose" commands you want
docker-compose up

At the end of this process, add eval "$(docker-machine env myBoxName)" to your .bash_profile or you will get the following error when you open a new shell or terminal.

"Cannot connect to the Docker daemon. Is the docker daemon running on this host?"

If you start the docker container after opening the terminal, you can either run eval "$(docker-machine env myBoxName)" manually, or reload your bash profile (source ~/.bash_profile).

Leave a Comment