Docker Machine Quick Install Docker environment

Source: Internet
Author: User
Tags docker machine

What is Docker machine?

The MaChine is a tool for simplifying the installation of Docker environments. How to simplify the method, for example, installing a Docker environment in Ubuntu to install in accordance with the System configuration tutorial, which day changed the CentOS system, but also follow the system configuration tutorial installed. There are many versions of the mainstream Linux system on the market, and it's not a hassle to install. Using the machine tool is a lot easier, with one or two commands to install a Docker environment on a mainstream Linux system, without the user having to consider what the operating system is.

On the other hand, machine also has Docker tools to manage what virtualization technology, generic Drive default management of LXC container technology. I personally understand that this is how the specific Docker official original design, but also need further exploration.

1, first look at the Docker machine support Docker for what virtualization technology drivers

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s4.51cto.com/wyfs02/m01/78/ce/wkiom1adiz7t-9zsaabjho1gfwq140.png "title=" Clipboard.png "alt=" Wkiom1adiz7t-9zsaabjho1gfwq140.png "width=" "height=" 460 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:400px; height:460px; "/>

2, Installation Docker-machine

Operating system: ubuntu14.04_x64

The docker-machine code is hosted on GitHub, and the binaries are stored on AWS S3, so you need to flip the wall to be under, I also uploaded a to 51cto, which can be downloaded using: http://down.51cto.com/data/2139681

Download and upload to the current directory of the Ubuntu system, then execute:

$ sudo mv Docker-machine_linux-amd64/usr/local/bin/docker-machine

If you have access to AWS S3 storage, you can run the following command directly under the root user:

$ curl-l https://github.com/docker/machine/releases/download/v0.5.3/docker-machine_linux-amd64 >/usr/local/bin /docker-machine && chmod +x/usr/local/bin/docker-machine

When the command executes successfully, you can view the version:

$ docker-machine Version

Docker-machine version 0.5.3, build 4d39a66

3. Next, quickly create a Docker host with the Docker-machine command

Note: The docker-machine connects to the host via SSH, downloads and installs the Docker tool from the Internet, needs to install with root permission, under the Ubuntu system, the default prohibits the root user to log into the system, Therefore, you need to configure root to allow SSH to log on to the system and avoid interactive logins or private key logins.

1) allow root SSH login

# Vi/etc/ssh/sshd_config

Permitrootlogin Root #修改此项为允许root登录

# Service SSH Restart

2) Create a key pair

# Ssh-keygen #一直回车

3) non-interactive root login system

# Ssh-copy-id [email protected]

4) Enable VISIBLEPW

# vi/etc/sudoers

Defaults VISIBLEPW

Press wq! to save the exit! Ashamed, still not quite understand the practical function of this VISIBLEPW.

If you do not add this bar, you may report the following error:

error creating machine: error running  provisioning: something went wrong running an ssh command!command :  sudo hostname ubuntu && echo  "Ubuntu"  | sudo tee / Etc/hostnameerr     : exit status 1output  : sudo:  no tty present and no askpass program specifiedSorry, try  Again.sudo: no tty present and no askpass program specifiedsorry,  try again.sudo: no tty present and no askpass program  Specifiedsorry, try again.sudo: 3 incorrect password attempts 

5) using the generic type of driver, create a docker host with a name of 18.5

# docker-machine create-d generic--generic-ip-address=192.168.18.5--generic-ssh-user=root 18.5

creating ca: /root/.docker/machine/certs/ca.pemcreating client certificate: /root/. Docker/machine/certs/cert.pemrunning pre-create checks ... Creating machine ... (18.5)  No SSH key specified. Connecting to this machine now  And in the future will require the ssh agent to contain  the appropriate key. waiting for machine to be running, this may take a few  Minutes ... Machine is running, waiting for ssh to be available ... Detecting operating system of created instance ... Detecting the provisioner ... Provisioning with ubuntu (Upstart) ... Installing docker ... 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 docker to this machine, run:  Docker-machine env ubuntu

Parameter description:

-D Driver #指定基于什么虚拟化技术的驱动

--generic-ip-address #指定要安装宿主机的IP, here is the local IP. In other words, you can also install Docker for other hosts, provided the SSH root user is free of interactive login or private key authentication.

--generic-ssh-user #SSH的用户

--generic-key-key #指定私钥来实现免交互登录


After waiting a few minutes, Docker installs successfully and can manage the container through Docker commands.

# Docker-machine LS

NAME ACTIVE DRIVER State URL SWARM DOCKER errors18.252-generic Ru Nning tcp://192.168.18.252:2376 v1.9.1


Docker-machine command:

  • Help to view assistance information

  • Active viewing of active Docker hosts

  • Configuration information for the config output connection

  • Create creates a Docker host

  • Env shows the environment variables that are required to connect to a host

  • Inspect output host update information

  • IP Get Docker host address

  • Kill stops a Docker host

  • LS Lists all managed Docker hosts

  • Regenerate-certs TLS authentication information for a host re-successfully

  • Restart restarting the Docker host

  • RM Delete Docker Host

  • SCP to copy files between Docker hosts

  • SSH ssh to the host to execute the command

  • Start starts a host

  • Status View a host State

  • Stop stopping a host

  • Upgrade Update host Docker version is up to date

  • URL gets the URL of the host


Installation Reference: https://docs.docker.com/machine/install-machine/

Command Reference: https://docs.docker.com/machine/reference/


This article is from the "Li Zhenliang Technology Blog" blog, make sure to keep this source http://lizhenliang.blog.51cto.com/7876557/1730028

Docker Machine Quick Install Docker environment

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.