This post is about using docker-machine to create, use and manage a Docker host inside of a local virtual machine. From here.
First you need to install the latest version of Docker and VirtualBox. In my case they are “Docker 18.03.1-ce for Mac” and “VirtualBox 5.2.10 for Mac”.
Create a machine(VM)
Connect to the machine(VM)
First, update your local Docker environment variables to make your local Docker client connect to Docker inside the created machine rather than your local Docker.
1 2 3 4 5 6 7 8 9 10 11
This should be done every time when you open a new terminal in which you want to operate the Docker machine. Or you can set this into your “~/.zshrc” or “~/.bashrc” file, but if you do so, you have to make sure the Docker machine(VM) is running. More details of how to do so can be found in the official document here.
1 2 3 4 5 6 7 8
Start and stop machines
Use “unset” command to stop running Docker commands on the target machine
1 2 3 4
Besides the usage on local machine(VM), Docker Machine is also working with Docker host cloud providers. More details can be found here.