无需停机,手把手教您将 Docker CE 切换为 Docker EE
出品丨Docker公司(ID:docker-cn)编译丨小东每周一、三、五,与您不见不散!在最近发布的 Docker Engine 18.09 版本中,引入了一项名为“CE-EE Node Activate”的新功能。它可以让用户无缝地在现有的 Community Edition(CE)节点上执行 Enterprise 引擎的功能集,只需通过 D...
·
出品丨Docker公司(ID:docker-cn)
编译丨小东
每周一、三、五,与您不见不散!
在最近发布的 Docker Engine 18.09 版本中,引入了一项名为“CE-EE Node Activate”的新功能。它可以让用户无缝地在现有的 Community Edition(CE)节点上执行 Enterprise 引擎的功能集,只需通过 Docker 命令行“CE-EE Node Activate”应用一个许可证,并将 Docker 引擎切换到 Enterprise 引擎即可。
先决条件
- Docker Community Edition(CE)版本必须为18.09或更高版本;
- 必须安装所有 Docker 软件包:docker-cli、docker-server 和 containerd;
- CE 和 EE 之间的节点级引擎激活仅支持 Docker Enterprise Engine for Docker 的相同版本;
测试的基础设施
- 平台:Google Cloud Platform
- 测试实例:1个
测试的先决条件
- 使用 Google Cloud Engine 创建帐户(免费版);
- 选择 Ubuntu 18.10 作为操作系统实例;
验证 Ubuntu 18.10 版本
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.10 (Cosmic Cuttlefish)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.10"
VERSION_ID="18.10"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=cosmic
UBUNTU_CODENAME=cosmic
安装 Docker 18.09 版本
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic test"
sudo apt install docker-ce
~$ sudo docker version
Client:
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:49:01 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:16:44 2018
OS/Arch: linux/amd64
Experimental: false
运行 Nginx Docker 容器
$ sudo docker run -d -p 80:80 nginx
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx
a5a6f2f73cd8: Pull complete
67da5fbcb7a0: Pull complete
e82455fa5628: Pull complete
Digest: sha256:31b8e90a349d1fce7621f5a5a08e4fc519b634f7d3feb09d53fac9b12aa4d991
Status: Downloaded newer image for nginx:latest
ba4a5822d7c991c04418b2fbbcadb86057eef4d98ba3f930bff569ac8058468e
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ba4a5822d7c9 nginx "nginx -g 'daemon of…" 5 seconds ago Up 3 seconds 0.0.0.0:80->80/tcp peaceful_swanson
验证 Nginx Docker 容器是否正常运行
~$ sudo curl localhost:80
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.
For online documentation and support please refer to
nginx.org.
Commercial support is available at
nginx.com.
Thank you for using nginx.
将系统连接到 Docker Hub 帐户
$sudo docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: ajeetraina
Password:
WARNING! Your password will be stored unencrypted in /home/joginderkour1950/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
下载 Docker Enterprise 许可证
- 浏览 https://store.docker.com/my-content 下载您的 Docker Enterprise 许可证;
- 使用您的 Docker ID 登录;
- 在您的个人资料页面下,点击“My Content”;
- 点击“Setup”获取 Docker Enterprise许可证;
- 在系统中下载您的 Docker Enterprise 许可证;
- 复制 .lic 文件的内容;
- 在 Ubuntu 系统上创建一个名为 mylicense.lic 的文件,并将其保存在某个位置;
激活 EE 许可证
即使您的用户是 docker group 的一部分,您也必须使用sudo。
$ sudo docker engine activate --license mylicense.lic
License: Quantity: 10 Nodes Expiration date: 2018-12-10 License is currently active
18.09.0: resolved
267a9a121ee1: done
4365cd59d876: done [==================================================>] 1.161kB/1.161kB
7ec4ee35c404: done [==================================================>] 4.55MB/4.55MB
3c60d2c9ddf3: done [==================================================>] 25.71MB/25.71MB
55fa4079a8ab: done [==================================================>] 1.122MB/1.122MB
c5a93cbd4679: done [==================================================>] 333.9kB/333.9kB
e661b0f8ba29: done [==================================================>] 4.82kB/4.82kB
Successfully activated engine.
Restart docker with 'systemctl restart docker' to complete the activation.
重新启动 Docker 服务
$ sudo systemctl restart docker
验证 Docker Enterprise 的版本
$ sudo docker version
Client:
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:49:01 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:17:07 2018
OS/Arch: linux/amd64
Experimental: false
验证 Nginx 容器是否仍在运行
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ba4a5822d7c9 nginx "nginx -g 'daemon of…" 6 minutes ago Up 6 minutes 0.0.0.0:80->80/tcp peaceful_swanson
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献11条内容
所有评论(0)