Manage machine-5 minutes a day to play Docker container technology (47)

Source: Internet
Author: User
Tags docker machine

docker-machine The process of creating machines is simple and well suited for multi-host environments. In addition, Docker machine provides a number of sub-commands to facilitate the management of machine. One of the most common is the ability to perform Docker-related operations without having to log in to machine.

As we learned before, to execute a remote docker command we need to -H Specify a connection string for the target host, such as:

Docker-h tcp://192.168.56.105:2376 PS

Docker machine makes this process even easier. docker-machine env host1displays all the environment variables required to access host1:

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170728-1501192742912071373.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170728-1501192820980083032.jpg "alt=" 226.png "style=" border:0px;vertical-align:middle; "/ >

Follow the prompts to execute eval $(docker-machine env host1) :

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170728-1501192742934053478.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170728-1501192821269017432.jpg "style=" border:0px;float:none; "/>

$HOME/.BASHRC   is configured with   ps1= "[\[email protected]\h \w$ (__DOCKER_MACHINE_PS1)]\$ ' , which is used to display the current Docker host.

All Docker commands executed in this state have the effect of executing on host1, such as starting a BusyBox container:

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170728-1501192742977055298.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170728-1501192821418005864.jpg "style=" border:0px;float:none; "/>

  eval $ (docker-machine env host2)   switch to Host2:

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170728-1501192743012056832.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170728-1501192821641068446.jpg "style=" border:0px;float:none; "/>

Here are a few useful docker-machine subcommands:

docker-machine upgrade Update your machine's Docker to the latest version, which can be executed in bulk:

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170728-1501192743057086277.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170728-1501192821879093842.jpg "style=" border:0px;float:none; "/>

docker-machine config to view the Docker daemon configuration for machine:

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170728-1501192743055008359.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170728-1501192822158084872.jpg "style=" border:0px;float:none; "/>

stop/start/restart   is the operating system operation on machine, and   stop/start/restart Docker daemon.

docker-machine scp You can copy files between different machine, such as:

Docker-machine SCP host1:/tmp/a host2:/tmp/b

Visible, in the multi-host environment Docker machine can greatly improve efficiency, and the operation is very simple, I hope everyone can master.

In the next section we begin to learn about the container network across hosts.

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-20170728-1501192822377093870.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; "/>

Manage machine-5 minutes a day to play Docker container technology (47)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.