第 7 章 多主机管理 - 045 - 安装 Docker Machine

安装 Docker Machine

先安装docker

官方安装docker-machine的文档地址:https://docs.docker.com/machine/install-machine/

安装方法很简单,执行如下命令:

curl -L https://github.com/docker/machine/releases/download/v0.9.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine

第 7 章 多主机管理 - 045 - 安装 Docker Machine

 

赋予 docker-machine可执行的权限

chmod +x docker-machine

cp docker-machine /usr/local/bin/

 第 7 章 多主机管理 - 045 - 安装 Docker Machine

 

查看docker-machine 的版本信息

docker-machine version

第 7 章 多主机管理 - 045 - 安装 Docker Machine

 

下载以下文件在https://github.com/docker/machine/tree/master/contrib/completion/bash/

docker-machine-prompt.bash

docker-machine-wrapper.bash

docker-machine.bash

 

将下载的completion scrip放置到 /etc/bash_completion.d 目录下。然后将如下代码添加到$HOME/.bashrc:

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

 第 7 章 多主机管理 - 045 - 安装 Docker Machine

 

或者执行脚本安装

先安装docker

 

 1 #!/bin/bash
 2 cp /etc/apt/sources.list /etc/apt/sources.list.bak
 3 echo '
 4 # deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
 5 deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
 6 deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
 7 deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
 8 deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
 9 deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
10 deb http://mirrors.aliyun.com/ubuntu/ xenial universe
11 deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
12 deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
13 deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
14 deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
15 deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
16 deb http://archive.canonical.com/ubuntu xenial partner
17 deb-src http://archive.canonical.com/ubuntu xenial partner
18 deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
19 deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
20 deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
21 deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
22 ' > /etc/apt/sources.list
23 
24 sudo apt-get update
25 apt-get install -y apt-transport-https ca-certificates curl software-properties-common
26 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
27 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu  $(lsb_release -cs)  stable"
28 sudo apt-get update
29 sudo apt-get install -y docker-ce
30 curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://53dc37d0.m.daocloud.io
31 systemctl restart docker.service

 

 

 

再安装docker-machine

 1 #!/bin/bash
 2 #Install Machine directly
 3 version='v0.14.0'
 4 base=https://github.com/docker/machine/releases/download/$version &&
 5   curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&
 6   sudo install /tmp/docker-machine /usr/local/bin/docker-machine
 7   
 8 docker-machine version
 9 
10 #Install bash completion scripts
11 path=https://raw.githubusercontent.com/docker/machine/$version
12 for i in docker-machine-prompt.bash docker-machine-wrapper.bash docker-machine.bash
13 do
14   sudo wget "$path/contrib/completion/bash/${i}" -P /etc/bash_completion.d
15 done
16 
17 echo 'PS1="[\u@\h \W$(__docker_machine_ps1)]\$"' >> $HOME/.bashrc 
18 source $HOME/.bashrc 
19 
20 reboot

 

 

 

 

----------------------------引用来自----------------------------

https://mp.weixin.qq.com/s?__biz=MzIwMTM5MjUwMg==&mid=2653587738&idx=1&sn=22de0b8dab37557b6d496fa87695d36b&chksm=8d308103ba470815ff079521b5b1dd8f0624a6eedce74f3a65cfb601dffb886cc31fd9e50fdb&scene=21#wechat_redirect

上一篇:力扣算法题—045跳跃游戏二


下一篇:L1-045 宇宙无敌大招呼