Windows 10 Docker Machine deployment Ubuntu 18.04lts host

Posted by jameslloyd on Sun, 16 Feb 2020 11:26:28 +0100

1. Install Docker Machine

If Git is installed, you can use git bash to execute the following command:

$ base= &&
  mkdir -p "$HOME/bin" &&
  curl -L $base/docker-machine-Windows-x86_64.exe > "$HOME/bin/docker-machine.exe" &&
  chmod +x "$HOME/bin/docker-machine.exe"

Or link to the Internet in a good environment, download directly from the web page:

I have tried to fail the above, can only help friends, download.

Run Powershell as an administrator,

PS C:\WINDOWS\system32> cd
PS C:\Users\ach> mkdir -p bin
PS C:\Users\ach> cd .\bin\
PS C:\Users\ach\bin> pwd


PS C:\Users\ach\bin>

Copy the downloaded file to C:\Users\ach\bin and rename it to: docker-machine.exe

Add C:\Users\ach\bin to the PATH of the environment variable

PS C:\Users\ach> docker-machine.exe version
docker-machine.exe version 0.16.2, build bd45ab13
PS C:\Users\ach>

This is the installation.

2. Ubuntu configure SSH password free login

Ubuntu uses 18.04LTS Desktop version IP address:

Install ssh server

Verify sshd service

On the Internet, scp is mostly used to copy to the target end, rename it to authorized keys, and adjust the permissions. It is always unclear what permissions are set to, and the following methods are usually used:

In Ubuntu, sir becomes the rsa secret key,

Then we use ssh copy ID to configure our own ssh password free login. That is to say, we verify the ssh password free login and automatically generate the authorized_keys file.

Verify password free login


3. Configure Windows password free to Ubuntu

Install Openssh and generate rsa secret key

Please refer to: Post supplementary link address


Copy the secret key to Ubuntu

Log in to Ubuntu and append the secret key to authorized keys

exit and verify password free login

Password free login succeeded.

4. Use docker machine to remotely configure the docker running environment of Ubuntu

In order to reduce exceptions, use administrator rights to run powershell. When docker machine executes commands remotely through ssh, users need sudo rights and password free

The generic driver is generally used to link Linux servers:

docker-machine.exe create --driver generic --generic-ip-address= --generic-ssh-key=.ssh/id_rsa --generic-ssh-user=sleeber Machine-120

Because it is in powershell environment, using the absolute path of - Generic SSH key will cause errors. It is recommended to cd to the home directory and use the relative path. The main parameter meanings are as follows:

In the above way, docker machine will automatically install docker

However, due to the domestic network environment image, it usually takes a lot of time. During installation, the execution log is not printed by default. You can use the -- debug parameter to view the status in real time:

docker-machine.exe --debug create --driver generic --generic-ip-address= --generic-ssh-key=.ssh/id_rsa --generic-ssh-user=sleeber Machine-120

Use ctrl+C to abort execution and rm to delete the host

If the network environment is good, the installation can be completed. I have failed all the time. I can only install docker manually, and then use docker machine to connect to Ubuntu

You can refer to: , no more.

sudo apt-get remove docker docker-engine containerd runc
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

//Use the official recommendation source {not recommended}
curl -fsSL | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

//Use alicloud's source {recommendation}
curl -fsSL | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

//Software source upgrade
sudo apt-get update
//Install docker
sudo apt-get install docker-ce docker-ce-cli

//You can specify the version to install docker:
sudo apt-get install docker-ce=<VERSION> -y
//View supported docker versions
sudo apt-cache madison docker-ce

After the manual installation of docker, use the docker machine link:


Then wait for the installation to complete and check the status

Test Docker host

Run Docker Hello World

At this point, Docker Machine can connect to Ubuntu 18.04lts Docker host.

Published 33 original articles, won praise 7, visited 100000+
Private letter follow

Topics: Docker Ubuntu ssh sudo