
Setting up Docker Toolbox
Follow these steps for setup:
- Let's use docker-machine to set up our environment. First, we list all Docker-ready VMs we have currently defined on our system. If you have just installed Docker Toolbox, you should see the following output:

- OK, we can see that there is a single VM called default installed, but it is currently in the STATE of stopped. Let's use docker-machine to start this VM so we can work with it:
$ docker-machine start default
This produces the following output:
If we now list the VMs again, we should see this:
The IP address used might be different in your case, but it will definitely be in the 192.168.0.0/24 range. We can also see that the VM has Docker version 18.06.1-ce installed.
- If, for some reason, you don't have a default VM or you have accidentally deleted it, you can create it using the following command:
$ docker-machine create --driver virtualbox default
This will generate the following output:
If you carefully analyze the preceding output, you will see that docker-machine automatically downloaded the newest ISO file for the VM from Docker. It realized that my current version was outdated and replaced it with version v18.09.6.
- To see how to connect your Docker client to the Docker Engine running on this virtual machine, run the following command:
$ docker-machine env default
This outputs the following:
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/Users/gabriel/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell:
# eval $(docker-machine env default)
- We can execute the command listed on the last line in the preceding code snippet to configure our Docker CLI to use Docker running on the default VM:
$ eval $(docker-machine env default)
- And now we can execute the first Docker command:
$ docker version
This should result in the following output:
We have two parts here, the client and the server part. The client is the CLI running directly on your macOS or Windows laptop, while the server part is running on the default VM in VirtualBox.
- Now, let's try to run a container:
$ docker run hello-world
This will produce the following output:
The preceding output confirms that Docker Toolbox is working as expected and can run containers.