docker-machine
提供了一个upgrade
命令,但它只能升级到最新的稳定版本
我想在我的 docker 机器上安装 1.10RC2,但我不确定该怎么做
更新
在docker 发布页面它显示该命令:
curl -fsSL https://test.docker.com/ | sh
我想尝试一下。我通过 ssh 登录docker-machine ssh swarm-master
并运行了它。
它看起来很有希望……运行它似乎是一个安装/升级脚本,它做了很多事情。之后:
root@swarm-master:~# docker version
Client:
Version: 1.10.0-rc2
API version: 1.22
Go version: go1.5.3
Git commit: c1cdc6e
Built: Wed Jan 27 22:14:06 2016
OS/Arch: linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
似乎已经升级,但守护进程没有运行。
https://docs.docker.com/engine/articles/systemd/ 展示了几种方法。我尝试过:
$ sudo systemctl start docker
和
$ sudo service docker start
在这两种情况下,命令都返回而没有输出,但似乎没有执行任何操作,守护进程仍然没有运行。
我的主机是 Debian 8。
我可以这样做docker daemon
,它在前台运行......第一次这样做时它经历了迁移了我所有的图片... 看起来运行良好,但是
所以现在我的问题是 - 如何正确地(如:与 docker-machine 所做的相同)运行守护进程?
答案1
所以,我找到了一种方法:
$ docker-machine ssh swarm-master
swarm-master# curl -fsSL https://test.docker.com/ | sh
swarm-master# docker daemon
等待守护进程将所有图像更新为 1.10 格式,然后让其保持运行。
同时在另一个 shell 中:
$ docker-machine regenerate-certs swarm-master
(我不知道为什么我们必须这样做,但如果没有这样做,最后一次重启就会失败)
该命令应该完成,尽管出现以下警告:
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Unable to verify the Docker daemon is listening: Maximum number of retries (10) exceeded
然后:
$ docker-machine restart swarm-master
$ eval $(docker-machine env --swarm swarm-master)
$ docker-machine ls
此时你应该看到主服务器已升级并正在运行:
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
swarm-master * (swarm) digitalocean Running tcp://123.45.67.89:2376 swarm-master (master) v1.10.0-rc2
eval
env
对群中的每台机器重复相同的步骤(减去)。
不幸的是仍然存在一个问题:
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
swarm-1 - digitalocean Running tcp://123.45.67.98:2376 swarm-master v1.10.0-rc2
swarm-master * (swarm) digitalocean Running tcp://123.45.67.89:2376 swarm-master (master) v1.10.0-rc2
看上去不错吧?
但:
$ docker info
Containers: 7
Images: 13
Role: primary
Strategy: spread
Filters: health, port, dependency, affinity, constraint
Nodes: 1
swarm-master: 123.45.67.89:2376
└ Status: Healthy
└ Containers: 7
└ Reserved CPUs: 0 / 1
└ Reserved Memory: 0 B / 1.026 GiB
└ Labels: executiondriver=native-0.2, kernelversion=3.16.0-4-amd64, operatingsystem=Debian GNU/Linux 8 (jessie), provider=digitalocean, storagedriver=aufs
CPUs: 1
Total Memory: 1.026 GiB
Name: 0dc444daa840
只有一个节点被识别为群体的一部分:(
为了修复这个问题,进入丢失的 Swarm 节点:
$ docker-machine ssh swarm-1
swarm-1# docker run -d swarm join --addr=<node ip>:2376 consul://<consul ip>:8500
docker info
现在应该显示两个节点都在群中。
答案2
令人惊讶的是,这个问题还没有得到正确的回答,也许事情已经发生了变化,但这很容易。我刚刚在一个有主服务器和两个成员的集群上运行了这个测试。
前:
C:\> docker version
Client:
Version: 17.06.0-ce
API version: 1.29 (downgraded from 1.30)
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:30:30 2017
OS/Arch: windows/amd64
Server:
Version: 17.05.0-ce
API version: 1.29 (minimum version 1.12)
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 21:43:09 2017
OS/Arch: linux/amd64
Experimental: false
以下是按顺序排列的命令:
C:\> docker-machine upgrade default
Waiting for SSH to be available...
Detecting the provisioner...
Upgrading docker...
Stopping machine to do the upgrade...
Upgrading machine "default"...
Copying I:\Docker\cache\boot2docker.iso to I:\Docker\machines\default\boot2docker.iso...
Starting machine back up...
Restarting docker...
C:\> docker-machine upgrade swarmnode02
Waiting for SSH to be available...
Detecting the provisioner...
Upgrading docker...
Stopping machine to do the upgrade...
Upgrading machine "swarmnode02"...
Copying I:\Docker\cache\boot2docker.iso to I:\Docker\machines\swarmnode02\boot2docker.iso...
Starting machine back up...
Restarting docker...
C:\> docker-machine upgrade swarmnode03
Waiting for SSH to be available...
Detecting the provisioner...
Upgrading docker...
Stopping machine to do the upgrade...
Upgrading machine "swarmnode03"...
Copying I:\Docker\cache\boot2docker.iso to I:\Docker\machines\swarmnode03\boot2docker.iso...
Starting machine back up...
Restarting docker...
后:
C:\> docker version
Client:
Version: 17.06.0-ce
API version: 1.30
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:30:30 2017
OS/Arch: windows/amd64
Server:
Version: 17.06.1-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: 874a737
Built: Thu Aug 17 22:54:55 2017
OS/Arch: linux/amd64
Experimental: false
C:\> docker-machine ls
NAME ACTIVE DRIVER STATE URL SWAR
M DOCKER ERRORS
default * vmwareworkstation Running tcp://192.168.200.132:2376
v17.06.1-ce
swarmnode02 - vmwareworkstation Running tcp://192.168.200.133:2376
v17.06.1-ce
swarmnode03 - vmwareworkstation Running tcp://192.168.200.134:2376
v17.06.1-ce