Docker Machine
Docker machine has two use cases:
I have an older desktop system and want to run Docker on Mac or Windows
I want to provision Docker hosts on remote systems
Difference between docker engine and docker machine is:
docker engine is what is running our applications, or actually doing the work
docker machine is for managing docker hosts (that are running docker engine)
Create new host
$ docker-machine create --driver virtualbox default
Creating CA: /Users/ondrej/.docker/machine/certs/ca.pem
Creating client certificate: /Users/ondrej/.docker/machine/certs/cert.pem
Running pre-create checks...
(default) Image cache directory does not exist, creating it at /Users/ondrej/.docker/machine/cache...
(default) No default Boot2Docker ISO found locally, downloading the latest release...
(default) Latest release for github.com/boot2docker/boot2docker is v18.01.0-ce
(default) Downloading /Users/ondrej/.docker/machine/cache/boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v18.01.0-ce/boot2docker.iso...
(default) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
Creating machine...
(default) Copying /Users/ondrej/.docker/machine/cache/boot2docker.iso to /Users/ondrej/.docker/machine/machines/default/boot2docker.iso...
(default) Creating VirtualBox VM...
(default) Creating SSH key...
(default) Starting the VM...
(default) Check network to re-create if needed...
(default) Found a new host-only adapter: "vboxnet0"
(default) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env defaultGet list of hosts
Get environment commands
Then we are supposed to run this to connect our shell to the docker host.
Get IP address of docker host
Test docker machine
Get nginx docker and run it. Then try to talk to the nginx.
Try to kill docker machine, if you do that, no docker engines will be available. See what happends when you run curl $(docker-machine ip default):8000 again.
Provisioning on Cloud
Docker machine can provision docker engines in a cloud, see documentation for more.
Last updated
Was this helpful?