出品丨Docker公司(ID:docker-cn)
编译丨小东
每周一、三、五,与您不见不散!
2018年11月8日,对于 Docker 社区用户来说是美好的一天,因为 Docker 18.09 CE 的全新稳定版本正式上线,这个版本将持续支持7个月,下一个即将到来的版本是 Docker 19.03 CE。同时作为一名企业版用户,我也很高兴 Docker Enterprise 2.1 增加了对 Windows Server 1709、1803和2019的支持。
在这篇文章中,我将尝试使用 Docker CLI 将 CE 引擎升级到 EE 引擎,以下是将运行17.12.0-ce 引擎的 CentOS 机器升级到18.09(EE引擎)的详细步骤。
$ docker version
Client:
Version: 17.12.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:10:14 2017
OS/Arch: linux/amd64
Server:
Engine:
Version: 17.12.0-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:12:46 2017
OS/Arch: linux/amd64
Experimental: false
让我们添加稳定的镜像仓库,以便我们有最新的软件包来安装新版本的 Docker CE。
$ sudo yum-config-manager \
--add-repo https://download.docker.com/linux/centos/docker-ce.repo
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
安装特定版本的 Docker 而不是始终使用最新版本,首先请先列出可用版本。
$ sudo yum list docker-ce –showduplicates
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
docker-ce-stable | 3.5 kB 00:00:00
(1/2): docker-ce-stable/x86_64/updateinfo | 55 B 00:00:00
(2/2): docker-ce-stable/x86_64/primary_db 19 kB 00:00:00
Installed Packages
docker-ce.x86_64 17.12.0.ce-1.el7.centos @docker-ce-stable
Available Packages
docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.3.ce-1.el7 docker-ce-stable
docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 18.03.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 18.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable
安装特定版本的标准方法是使用 $ sudo yum install。
版本字符串是软件包名称加上第一个连字符的版本。 在上面的示例中,完全限定的软件包名称为 docker-ce-18.09.0 。
让我们将 Docker CE 升级到18.09版本。
$ sudo yum install docker-ce-18.09.0
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 0:17.12.0.ce-1.el7.centos will be updated
---> Package docker-ce.x86_64 3:18.09.0-3.el7 will be an update
--> Processing Dependency: containerd.io for package: 3:docker-ce-18.09.0-3.el7.x86_64
--> Processing Dependency: docker-ce-cli for package: 3:docker-ce-18.09.0-3.el7.x86_64
--> Running transaction check
---> Package containerd.io.x86_64 0:1.2.0-3.el7 will be installed
---> Package docker-ce-cli.x86_64 1:18.09.0-3.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================================================================
Updating:
docker-ce x86_64 3:18.09.0-3.el7 docker-ce-stable 19 M
Installing for dependencies:
containerd.io x86_64 1.2.0-3.el7 docker-ce-stable 22 M
docker-ce-cli x86_64 1:18.09.0-3.el7 docker-ce-stable 14 M
Transaction Summary
====================================================================================================================================================================================
Install ( 2 Dependent packages)
Upgrade 1 Package
Total download size: 55 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/3): containerd.io-1.2.0-3.el7.x86_64.rpm | 22 MB 00:00:07
(2/3): docker-ce-18.09.0-3.el7.x86_64.rpm | 19 MB 00:00:09
(3/3): docker-ce-cli-18.09.0-3.el7.x86_64.rpm | 14 MB 00:00:03
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 5.1 MB/s | 55 MB 00:00:10
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : containerd.io-1.2.0-3.el7.x86_64 1/4
Installing : 1:docker-ce-cli-18.09.0-3.el7.x86_64 2/4
Updating : 3:docker-ce-18.09.0-3.el7.x86_64 3/4
Cleanup : docker-ce-17.12.0.ce-1.el7.centos.x86_64 4/4
Verifying : 1:docker-ce-cli-18.09.0-3.el7.x86_64 1/4
Verifying : 3:docker-ce-18.09.0-3.el7.x86_64 2/4
Verifying : containerd.io-1.2.0-3.el7.x86_64 3/4
Verifying : docker-ce-17.12.0.ce-1.el7.centos.x86_64 4/4
Dependency Installed:
containerd.io.x86_64 0:1.2.0-3.el7 docker-ce-cli.x86_64 1:18.09.0-3.el7
Updated:
docker-ce.x86_64 3:18.09.0-3.el7
Complete!
从 CE 引擎激活 EE 引擎还有一些要求:
- Docker Community Edition(CE)版本必须为18.09或更高版本。
- 必须安装所有 Docker 软件包:docker-cli、docker-server和 containerd。
- 有效的 Docker EE 许可证(从您的组织配置文件下的 Docker Hub 获取)。
该功能还有一些限制:
- 只支持 x86 Linux 节点。
- 目前不支持 Windows 节点。
- CE 和 EE 之间的节点级引擎激活仅在 Docker 企业版引擎的相同版本中受支持。
- Docker CE 的早期版本不支持此功能。
考虑到上述要求和限制,我们可以检查 Docker 的版本,以确保我们可以进行 CE-EE 节点的激活。
$ docker version
Client:
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:48:22 2018
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:19:08 2018
OS/Arch: linux/amd64
Experimental: false
以下是此版本中提供的新管理命令:
$ sudo docker engine --help
Usage: docker engine COMMAND
Manage the docker engine
Commands:
activate Activate Enterprise Edition
check Check for available engine updates
update Update a local engine
请确保已从 Docker Store 下载许可证文件以使用以下命令激活许可证:
$ sudo docker engine activate --license docker_subscription.lic
[sudo] password for sujaypillai:
License: Quantity: 20 Nodes Expiration date: 2019-07-30 License is currently active
18.09.0: resolving
unable to pull image docker.io/store/docker/engine-enterprise-dm:18.09.0: failed to resolve reference "docker.io/store/docker/engine-enterprise-dm:18.09.0": pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
此处失败的原因是需要使用下载许可文件时使用的相同用户 id 登录到 dockerhub。
$ sudo docker login docker.io -u sujaypillai
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
让我们激活 EE 许可证:
$ sudo docker engine activate --license docker_subscription.lic
License: Quantity: 10 Nodes Expiration date: 2019-05-25 License is currently active
18.09.0: resolved
8426d869cd15: done [==================================================>] 433B/433B
04943fdcc3c7: done
130b7807ec4a: done
3470a7591bbb: done [==================================================>] 4.594kB/4.594kB
15bd6c72f8d4: done
22797e024efe: done [==================================================>] 850kB/850kB
Successfully activated engine.
Restart docker with 'systemctl restart docker' to complete the activation.
一旦重启系统并执行以下命令,您可能会看到服务器已经变为“Docker Engine - Enterprise”,而客户端仍然在社区版中。
$ docker version
Client:
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:48:22 2018
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Enterprise
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 33a45cd
Built: Wed Nov 7 00:19:46 2018
OS/Arch: linux/amd64
Experimental: false