本文共 11152 字,大约阅读时间需要 37 分钟。
出品丨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 versionClient: 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.repoFailed to set locale, defaulting to CLoaded plugins: fastestmirroradding repo from: https://download.docker.com/linux/centos/docker-ce.repograbbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.reporepo saved to /etc/yum.repos.d/docker-ce.repo
安装特定版本的 Docker 而不是始终使用最新版本,首先请先列出可用版本。
$ sudo yum list docker-ce –showduplicatesFailed to set locale, defaulting to CLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfiledocker-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 Packagesdocker-ce.x86_64 17.12.0.ce-1.el7.centos @docker-ce-stableAvailable Packagesdocker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.03.3.ce-1.el7 docker-ce-stabledocker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 18.03.0.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 18.03.1.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stabledocker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stabledocker-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.0Failed to set locale, defaulting to CLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfileResolving 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 MInstalling 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 MIs this ok [y/d/N]: yDownloading 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 checkRunning transaction testTransaction test succeededRunning transactionWarning: 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/4Dependency 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 的版本,以确保我们可以进行 CE-EE 节点的激活。
$ docker versionClient: 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 --helpUsage: 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 active18.09.0: resolvingunable 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 sujaypillaiPassword:WARNING! Your password will be stored unencrypted in /root/.docker/config.json.Configure a credential helper to remove this warning. Seehttps://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded
让我们激活 EE 许可证:
$ sudo docker engine activate --license docker_subscription.licLicense: Quantity: 10 Nodes Expiration date: 2019-05-25 License is currently active18.09.0: resolved8426d869cd15: done [==================================================>] 433B/433B04943fdcc3c7: done130b7807ec4a: done3470a7591bbb: done [==================================================>] 4.594kB/4.594kB15bd6c72f8d4: done22797e024efe: done [==================================================>] 850kB/850kBSuccessfully activated engine.Restart docker with 'systemctl restart docker' to complete the activation.
一旦重启系统并执行以下命令,您可能会看到服务器已经变为“Docker Engine - Enterprise”,而客户端仍然在社区版中。
$ docker versionClient: 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
转载地址:http://gawua.baihongyu.com/