The docker-machine of the Three Musketeers of Docker

Source: Internet
Author: User
Tags docker ps

#安装docker-machine[email protected]:~$ pwd/home/cupid[email protected]:~$ Lsdesktop docker-machine-linux-x86_64 Documents Downloads examples.desktop Music Pictures public Templates videos[email&nbsp ;p rotected]:~$ mv docker-machine-linux-x86_64 docker-machine[email protected]:~$ chmod +x docker-machine [email&  nbsp;protected]:~$ sudo scp docker-machine/usr/local/bin/docker-machine[email protected]:~$ docker-machine Version #安装成功docker-machine version 0.12.2, build 9371605##[email protected]:~$ cd/etc/bash_completion.d/[email  protected]:/etc/bash_completion.d$ lsapport_completion git-prompt Insservdesktop-file-validate Grub Li breoffice.sh[email protected]:/etc/bash_completion.d$ VI docker-machine-prompt.bash~## Add managed node 1) Generate Ssh-key and copy to managed node [email protected]:~# Ssh-keygen generating public/private RSA key pair. Enter file in which to save the key (/ROOT/.SSH/ID_RSA):/root/.ssh/id_rsa already exists. Overwrite (y/n)? Yenter PAssphrase (empty for no passphrase): Enter same passphrase Again:your identification have been saved In/root/.ssh/id_rsa. Your public key has been saved in/root/.ssh/id_rsa.pub.the key fingerprint is:sha256:                 vleikvwokkzltgnizoe2z1u13xuuylxkreyq1/z/o74 [email protected]the key ' s randomart image is:+---[RSA 2048]----+|                 ||           || O | |      O. .  O. || o O so. = O | | O. O.. O. * O o| | +o ...  +. +.+ O | | O.+.O.O. o+.=o...| | o=. o+. o.o+. oeb|+----[SHA256]-----+[email protected]:~# ssh-copy-id 192.168.142.169/usr/bin/ssh-copy-id:info:source of Key (s) to BES installed: "/root/.ssh/id_rsa.pub"/usr/bin/ssh-copy-id:info:attempting to log in with the new key (s), to fi Lter out all that is already installed/usr/bin/ssh-copy-id:info:1 key (s) remain to being installed--if you are prompted Now it's to install the new keys[email protected] ' s password:number of keys (s) Added:1now try logging into the Mach INE, with: "SSH" 192.168.142.169 ' and check to make sure, the key (s) you wanted were added. [email protected]:~# Ssh-copy-id 192.168.142.170/usr/bin/ssh-copy-id:info:source of key (s) to be installed: "/ Root/.ssh/id_rsa.pub "The authenticity of Host ' 192.168.142.170 (192.168.142.170) ' can ' t be established. ECDSA Key fingerprint is sha256:nmynss3zgcbuh8jvygg4xriewfh0svvamihz2o+bzkc.are you sure you want to continue connecting ( yes/no)? Yes/usr/bin/ssh-copy-id:info:attempting to log in with the new key (s), to filter out any that is already installed/usr/ Bin/ssh-copy-id:info:1 key (s) remain to being installed--if you are prompted now it's to install the new keys[email&nbsp ;p rotected] ' s password:number of key (s) Added:1now try logging into the machine, with: "SSH ' 192.168.142.170 '" and CHEC K to make sure that is only the key (s) wanted were added. #无需输入密码可登陆169 [email protected]:~# ssh 192.168.142.169Welcom E to Ubuntu 16.04.2 LTS (gnu/linux 4.10.0-28-generic x86_64) * Documentation:https://help.ubuntu.com * management:https://landscape.canonical.com * SUPPORT:HTTPS://UBUNTU.COM/ADVANTAGE52 packages C An being Updated.1 update is a security update.2) add managed node because it is a virtual machine, specify a normal operating system can be [email protected]:~# docker-machine Create-- Driver generic--generic-ip-address=192.168.142.169 host1creating CA:/root/.docker/machine/certs/ca.pemcreating Client Certificate:/root/.docker/machine/certs/cert.pemrunning pre-create checks ... Creating machine ... (host1) 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 Ubuntu (SYSTEMD) ... Installing Docker ... 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! To see how to connect your Docker ClIent to the Docker Engine running in this virtual machine, Run:docker-machine env host1# View added host [email protected]:~#        Docker-machine lsname ACTIVE DRIVER State URL SWARM DOCKER ERRORShost1- Generic Running tcp://192.168.142.169:2376 v17.06.0-ce ~~3) How to manage node docker[[email protected]:~] #e    Cho $PS 1[\[email protected]\h:\w$ (__DOCKER_MACHINE_PS1)]\$[[email protected]:~] #docker-machine LsNAME   ACTIVE DRIVER State URL SWARM DOCKER errorshost1-generic Running           tcp://192.168.142.169:2376 v17.06.0-ce host2-generic Running tcp://192.168.142.170:2376 V17.06.0-ce #查看连接到host1需要的环境变量 [[email protected]:~] #docker-machine env host1export docker_tls_verify= "1" Export docker_host= "tcp://192.168.142.169:2376" Export docker_cert_path= "/root/.docker/machine/machines/host1" Export Docker_machine_name= "Host1" # Run this CommanD To configure your shell: # eval $ (docker-machine env host1) #查看连接到host2需要的环境变量 [[email protected]:~]# Docker-machine env host2export docker_tls_verify= "1" Export docker_host= "tcp://192.168.142.170:2376" Export DOCKER_ Cert_path= "/root/.docker/machine/machines/host2" Export Docker_machine_name= "Host2" # Run this command to configure Your shell: # eval $ (docker-machine env host2) #eval此环境变量即可连接到host2的docker [[email protected]:~] #eval $ (                  Docker-machine env host2) [[[Email protected]:~ [Host2]] #docker ps-acontainer ID IMAGE COMMAND CREATED STATUS PORTS names87300fa502e3 Busybo X "sh" about a hour ago Exited (0) about an hour ago focused                                                 _crayaea28d5d7030 busybox "-it" about an hour ago Created           keen_noetherc9370139a79e httpd    "Httpd-foreground" 5 days ago Exited (255) 2 hours ago 80/tcp quirky_hypatiae5d   eab94f264 CentOS "/bin/bash-c ' whi ..."           5 days ago Exited (255) 2 hours ago romantic_johnsond19d1c95874f registry:2   "/entrypoint.sh/e ..." 5 days ago Exited (255) 2 hours ago 0.0.0.0:5000->5000/tcp hardcore_colden~

The docker-machine of the Three Musketeers of Docker

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.