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”.
docker-machine create --driver virtualbox default
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. Show the content.
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. Get the host IP address.
docker-machine stop default
Besides the usage on local machine(VM), Docker Machine is also working with Docker host cloud providers. More details can be found here.