We must be more host in the production process, so I use the Docker-machine management tools to achieve the management of Docker on multiple hosts.
1, installation Docker-machine
setting environment variables;
base=https://github.com/docker/machine/releases/download/v0.14.0
Download
Curl-l $base/docker-machine-$ (uname-s)-$ (uname-m) >/tmp/docker-machine
Setting environment variables
sudo install/tmp/docker-machine/usr/local/bin/docker-machine
At this point, you can execute Docer-machine related instructions to verify success
[Email protected] ~]# Docker-machine--version
Docker-machine version 0.14.0, build 89b8332
2. Add Host
1, set no password login
2. Add Host
[Email protected] ~]# docker-machine create--driver generic--generic-ip-address=192.168.1.39 docker
Creating CA:/root/.docker/machine/certs/ca.pem
Creating Client Certificate:/ROOT/.DOCKER/MACHINE/CERTS/CERT.PEM
Running pre-create Checks ...
Creating machine ...
(Docker) No SSH key specified. Assuming an existing key in the default location.
Waiting for machine to is running, this could take a few minutes ...
Detecting operating system of created instance ...
Waiting for SSH to be available ...
Detecting the Provisioner ...
Provisioning with CentOS ...
Copying certs to the Local machine directory ...
Copying certs to the remote ...
Setting Docker configuration on the remote daemon ...
Checking connection to Docker ...
Docker is up and running!
Your Docker Client to the Docker Engine running on this virtual machine, Run:docker-machine env doc Ker
We're going to add ourselves in.
Now look at the action that executes this command
[Email protected] ~]# Ps-ef|grep Yum
Root 13455 13333 0 20:41 pts/2 00:00:00/usr/bin/ssh-f/dev/null-o passwordauthentication=no-o StrictHostKeyChecking=no -O userknownhostsfile=/dev/null-o loglevel=quiet-o connectionattempts=3-o connecttimeout=10-o controlmaster=no-o Con Trolpath=none [email protected]-P 22-tt sudo-e yum-y update-x docker-
Root 13459 13456 0 20:41 pts/3 00:00:00 sudo-e yum-y update-x docker-
Root 13472 13459 5 20:41 pts/3 00:00:13/usr/bin/python/bin/yum-y update-x docker-*
Root 13572 13502 0 20:45 pts/5 00:00:00 grep--color=auto Yum
After executing this command, install Dicker and other plugins in the upgrade
Verify that the addition is complete
[[email protected] ~]# Docker-machine ls
NAME ACTIVE DRIVER State URL SWARM DOCKER ERRORS
Docker-generic Running tcp://192.168.1.39:2376 v1.13.1
[Email protected] ~]#
Docker Machine Multi-host management