Published 6月 08, 2019 by with 0 comment

6 - 01 - Install Docker Machine



Docker Machine enables you to provision multiple remote Docker hosts on various flavors of Linux.
You have an old host for running docker, but this old host is not able to run new Docker application.


You can install Docker and Docker Machine in the old host, and run the Docker Engine locally.
Using Docker Machiner to remote controll other newer hosts to run new Docker application.



1. There are three KVM, and running the ubuntu-16.04.6-desktop-amd64.iso.
But in this lab, it will only use the KVM1.
KVM1 install Docker first. ping KVM2(192.168.122.251) and KVM3(192.168.122.64)
peter@peter-KVM:~$ docker version 
Client:
 Version:           18.09.6
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        481bc77
 Built:             Sat May  4 02:35:27 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.6
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       481bc77
  Built:            Sat May  4 01:59:36 2019
  OS/Arch:          linux/amd64
  Experimental:     false
peter@peter-KVM:~$ 
peter@peter-KVM:~$ ping -c 3 192.168.122.251
PING 192.168.122.251 (192.168.122.251) 56(84) bytes of data.
64 bytes from 192.168.122.251: icmp_seq=1 ttl=64 time=0.660 ms
64 bytes from 192.168.122.251: icmp_seq=2 ttl=64 time=0.501 ms
64 bytes from 192.168.122.251: icmp_seq=3 ttl=64 time=0.513 ms

--- 192.168.122.251 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2052ms
rtt min/avg/max/mdev = 0.501/0.558/0.660/0.072 ms
peter@peter-KVM:~$ 
peter@peter-KVM:~$ ping -c 3 192.168.122.64
PING 192.168.122.64 (192.168.122.64) 56(84) bytes of data.
64 bytes from 192.168.122.64: icmp_seq=1 ttl=64 time=0.971 ms
64 bytes from 192.168.122.64: icmp_seq=2 ttl=64 time=0.382 ms
64 bytes from 192.168.122.64: icmp_seq=3 ttl=64 time=0.489 ms

--- 192.168.122.64 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2011ms
rtt min/avg/max/mdev = 0.382/0.614/0.971/0.256 ms
peter@peter-KVM:~$ 

2. In KVM1, install Docker Machine(v0.16.1)
peter@peter-KVM:~$ curl -L https://github.com/docker/machine/releases/download/v0.16.1/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine &&
>     chmod +x /tmp/docker-machine &&
>     sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   617    0   617    0     0    901      0 --:--:-- --:--:-- --:--:--   900
100 26.8M  100 26.8M    0     0   579k      0  0:00:47  0:00:47 --:--:-- 1023k
[sudo] password for peter: 
peter@peter-KVM:~$ 

3. Verify the Docker Machine version.
peter@peter-KVM:~$ docker-machine -v
docker-machine version 0.16.1, build cce350d7
peter@peter-KVM:~$ 

4. Installing Command Completion
peter@peter-KVM:~$ docker-machine --version
docker-machine version 0.16.1, build cce350d7
peter@peter-KVM:~$ 
peter@peter-KVM:~$ cd /etc/bash_completion.d/
peter@peter-KVM:/etc/bash_completion.d$
peter@peter-KVM:/etc/bash_completion.d$ sudo wget https://raw.githubusercontent.com/docker/machine/v0.16.1/contrib/completion/bash/docker-machine-prompt.bash
peter@peter-KVM:/etc/bash_completion.d$ sudo wget https://raw.githubusercontent.com/docker/machine/v0.16.1/contrib/completion/bash/docker-machine-wrapper.bash
peter@peter-KVM:/etc/bash_completion.d$ sudo wget https://raw.githubusercontent.com/docker/machine/v0.16.1/contrib/completion/bash/docker-machine.bash
5. Add the following this script in the end line of $HOME/.bashrc
peter@peter-KVM:/etc/bash_completion.d$ vi $HOME/.bashrc

PS1='[\u@\h \W$(__docker_machine_ps1)]\$ '

6. logout and login again.

Reference:
1. docker/machine release page
https://github.com/docker/machine/releases/

2. Docker Machine Overview
https://docs.docker.com/machine/overview/


最初發表 / 最後更新: 2019.06.08 / 2019.06.08

0 comments:

張貼留言