In front of our lab environment, only one Docker host container is running on this host. However, in a real environment, there will be multiple host containers that start, run, stop, and destroy related containers in these hosts, regardless of whether they are located in the same host.
How can we manage such a multi-host environment efficiently?
The first problem we faced was installing and configuring Docker for all hosts.
In front of us, we manually installed the first Docker host step including
Install the HTTPS CA certificate
Add GPG Key
Add Docker apt Source
Installing Docker
Visible steps are still quite a lot of manual methods for multi-host environment inefficient and not easy to ensure consistency for this problem Docker gives the solution to Docker machine.
Docker machine allows you to install and configure the Docker host in bulk, this host can be a local VM, a physical machine, or a cloud host in a public cloud.
Docker machine supports installing configurations in different environments Docker host includes
General Linux Operating System
Virtualization platform-VirtualBox, VMWare, Hyper-V
OpenStack
Public cloud-Amazon Web Services, Microsoft Azure, Google Compute Engine, Digital Ocean, and more
Docker Machine has a unified name provider for these environments. For a particular providerdocker machine, install and configure the Docker host using the appropriate driver as shown in
650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170723-1500770399177065328.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170723-1500770599920076110.jpg "style=" border:0px;float:none; "/>
Here we study Docker machine through experiments.
Experimental environment Description
There are three host hosts running Ubuntu in the lab environment.
650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170723-1500770399114082601.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170723-1500770600155013099.jpg "alt=" 216.png "style=" BORDER:0PX;FONT-SIZE:14.4PX; Vertical-align:middle; "/>
We will install Docker machine on the 192.168.56.101 and then deploy Docker on the other two hosts via the Docker-machine command.
Installing Docker Machine
Official installation documentation at https://docs.docker.com/machine/install-machine/
The installation method is simple to execute the following command
Curl-l https://github.com/docker/machine/releases/download/v0.9.0/docker-machine-' uname-s '-' uname-m ' >/tmp/ Docker-machine &&
chmod +x/tmp/docker-machine &&
sudo cp/tmp/docker-machine/usr/local/bin/docker-machine
The downloaded execution file is put into the/usr/local/bin to execute docker-mahine version
The Verify command is available
650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170723-1500770399141023331.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170723-1500770600297081770.jpg "style=" border:0px;float:none; "/>
Note When you see this article, the Docker machine should have an updated version that can be installed by reference to the official documentation.
  tab
  key completion docker-mahine
  's subcommands and parameters. The installation method is to download completion script
from Https://github.com/docker/machine/tree/master/contrib/completion/bash
    directory. Then add the following code to $HOME/.BASHRC
Ps1= ' [\[email protected]\h \w$ (__docker_machine_ps1)]\$ '
The effect is to set the command-line prompt for docker-machine, but wait until the other two hosts are deployed to see the effect.
Docker machine is ready the current environment is as follows
650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170723-1500770399389022069.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170723-1500770600585059531.jpg "style=" border:0px;float:none; "/>
In the next section we learn how to create machine.
650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170711-1499780326078042943.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170723-1500770600733016714.jpg "alt=" QR code + fingerprint. png "style=" border:0px;font-family: ' Helvetica Neue ', Helvetica, ' Hiragino Sans GB ', ' Microsoft Yahei ', Arial, sans-serif;font-size:medium; "/>
Installing Docker machine-5 minutes a day to play Docker container technology (45)