Dokcer Machine
Docker Machine 可以批量安装和配置 docker host 提高docker的安装效率 同时减少人工安装操作的失误
[root@localhost ~]# yum install docker
必须手动给所有节点先安装好docker docker-machine create 不会给远程主机安装docker
[root@localhost ~]# curl -L https://github.com/docker/machine/releases/download/v0.15.0/docker-machine-Linux-x86_64 > /tmp/docker-machine
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
--:--:-- --:--:-- --:--:--
26.8M 26.8M :: :: --:--:--
[root@localhost ~]# mv /tmp/docker-machine /usr/local/bin/
[root@localhost ~]# chmod a+x /usr/local/bin/docker-machine
[root@localhost ~]# docker-machine version
docker-machine version 0.15., build b48dc28d
[root@localhost ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)?
[root@localhost ~]# ssh-copy-id 192.168.11.134
docker-machine安装
添加docker-machine管理节点
node1
[root@node1 ~]# yum install docker
[root@node1 ~]# ps -ef | grep yum
root : pts/ :: sudo -E yum -y update -x docker-*
root : pts/ :: /usr/bin/python /bin/yum -y update -x docker-*
root : pts/ :: grep --color=auto yum
[root@localhost ~]# docker-machine create --driver generic --generic-ip-address=192.168.11.134 node1 [root@localhost ~]# docker-machine env node1
export DOCKER_TLS_VERIFY=""
export DOCKER_HOST="tcp://192.168.11.134:2376"
export DOCKER_CERT_PATH="/root/.docker/machine/machines/node1"
export DOCKER_MACHINE_NAME="node1"
# Run this command to configure your shell:
# eval $(docker-machine env node1)
docker-machine指令
/usr/bin/docker-current: Error response from daemon: shim error: docker-runc not installed on system ln -s /usr/libexec/docker/docker-runc-current /usr/bin/docker-runc
问题
总结:
docker-machine实现的功能就是在一台主机上实现远程管理其他主机上的docker服务