Windows 10 Docker Machine deployment CentOS7 host

1. Install Docker Machine

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

$ base=https://github.com/docker/machine/releases/download/v0.16.0 &&
  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:

https://github.com/docker/machine/releases

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

Path
----
C:\Users\ach\bin

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. CentOS configuration SSH password free login

CentOS uses 7 Core version IP address: 192.168.1.100

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:

On CentOS, Mr. Cheng's rsa secret key is right,

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 CentOS

Install Openssh and generate rsa secret key

Please refer to: Post supplementary link address

 

Copy secret key to CentOS

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 CentOS

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

Configure firewall

sudo firewall-cmd --zone=public --add-port=2376/tcp --permanent

sudo firewall-cmd --reload

sudo firewall-cmd --zone=public --query-port=2376/tcp

The generic driver is generally used to link Linux servers:

docker-machine.exe create --driver generic --generic-ip-address=192.168.1.100 --generic-ssh-key=.ssh/id_rsa --generic-ssh-user=wntime Machine-100

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

   

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: https://docs.docker.com/install/linux/docker-ce/centos/ , no more.

sudo yum remove docker docker-common docker-selinux docker-engine
sudo yum install -y yum-utils device-mapper-persistent-data lvm2

//Use the official recommendation source {not recommended}
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

//Use alicloud's source {recommendation}
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum makecache fast
    
//Software source upgrade
sudo yum  update
    
//Install docker
sudo yum -y install docker-ce

//You can specify the version to install docker:
sudo yum -y install docker-ce-[VERSION]
    
//View supported docker versions
yum list docker-ce.x86_64 --showduplicates | sort -r

Configure docker domestic image and execute again

docker-machine.exe --debug create --driver generic --generic-ip-address=192.168.1.100 --generic-ssh-key=.ssh/id_rsa --generic-ssh-user=wntime Machine-100

docker does not recognize the installation

Manually install docker and configure startup

Re execution

docker-machine.exe --debug create --driver generic --generic-ip-address=192.168.1.100 --generic-ssh-key=.ssh/id_rsa --generic-ssh-user=wntime Machine-100

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 CentOS7 Docker host.

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

Keywords: Docker ssh sudo yum

Added by gunabalans on Sun, 16 Feb 2020 12:28:56 +0200