Docker安装配置华为云官方解决方案

 

软件介绍

 

Docker是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的镜像中,然后发布到任何流行的Linux或Windows机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口。

 

支持的操作系统

经过华为云严格实测,以下操作系统在鲲鹏生态中可以完整运行Docker的全部功能:

l   CentOS 7.5

 

centos-extra仓库必须处于“enabled”状态。这是操作系统默认配置,如果你已经设置成“disabled”,则需要重新设置。

相关命令如下:

l  查询仓库状态:yum repolist all

例如:yum repolist all|grep "CentOS-7 - Extras"

l  设置为“enabled”状态:yum-config-manager --enable

例如: yum-config-manager --enable "CentOS-7 - Extras - mirrors.huaweicloud.com"

l  设置为“disabled”状态:yum-config-manager --disable

例如:yum-config-manager --disable "CentOS-7 - Extras - mirrors.huaweicloud.com"

l   EulerOS 2.8

l   Ubuntu 18.04

安装与部署方式

Ubuntu操作系统

1.      准备环境

准备实例

从华为云官网购买鲲鹏云服务ECS实例,详细配置如下:

类别

子项

版本

云服务器配置

ECS实例类型

kc1.xlarge.4

ECS配置

4U16GB

EVS(系统盘)

高IO(40GB)

EVS(数据盘)

高IO(40GB)

云OS

Ubuntu

18.04

Kernel

4.15.0-29

安装依赖包

执行以下命令安装依赖包。

sudo apt-get update

sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

2.      执行安装

方式一:通过软件仓库安装

1)     老版本的Docker的命名为“docker”、“docker.io” 或 “docker-engine”,如果安装了这些版本,需要先卸载掉。

 

保存在“/var/lib/docker”/中的内容,包括图片、磁盘和网络配置等都会保留下来。

sudo apt-get remove docker docker-engine docker.io containerd runc

2)     添加Docker官方GPG key。

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

3)     设置Docker CE软件仓库版本为arm64。

sudo add-apt-repository \

"deb [arch=arm64] https://download.docker.com/linux/ubuntu \

$(lsb_release -cs) \

stable"

4)     安装docker-ce软件。

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io

 

如果需要安装指定版本的docker-ce,可以执行以下命令:

sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

方式二:下载软件包进行安装

1)     通过https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/arm64/,下载指定版本的软件包。

2)     执行命令安装软件包及依赖。

 

“package.deb”为下载的软件包。

sudo dpkg -i /path/to/package.deb

3.      启动软件

1)     启动docker。

sudo systemctl start docker

2)     使用一个hello-world镜像验证docker是否正常。

sudo docker run hello-world

回显内容如下:

Unable to find image 'hello-world:latest' locally 
latest: Pulling from library/hello-world 
3b4173355427: Pull complete  
Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8 
Status: Downloaded newer image for hello-world:latest 
 
Hello from Docker! 
This message shows that your installation appears to be working correctly. 
 
To generate this message, Docker took the following steps: 
 1. The Docker client contacted the Docker daemon. 
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 
    (arm64v8) 
 3. The Docker daemon created a new container from that image which runs the 
    executable that produces the output you are currently reading. 
 4. The Docker daemon streamed that output to the Docker client, which sent it 
    to your terminal. 
 
To try something more ambitious, you can run an Ubuntu container with: 
 $ docker run -it ubuntu bash 
 
Share images, automate workflows, and more with a free Docker ID: 
 https://hub.docker.com/ 
 
For more examples and ideas, visit: 
 https://docs.docker.com/get-started/

CentOS操作系统

1.      准备环境

准备实例

从华为云官网购买鲲鹏云服务ECS实例,详细配置如下:

类别

子项

版本

云服务器配置

ECS实例类型

rc3.xlarge.4

ECS配置

4U14GB

EVS(系统盘)

高IO(40GB)

EVS(数据盘)

高IO(40GB)

云OS

CentOS

7.5

Kernel

4.14.0-49

                安装依赖包

执行以下命令安装依赖包。

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

2.      执行安装

方式一:使用软件仓库安装

1)     老版本的docker的命名为“docker”或 “docker-engine”,如果安装了这些版本,需要先卸载掉。

 

保存在“/var/lib/docker/”中的内容,包括图片、磁盘和网络配置等都会保留下来。

sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate

2)     配置软件仓库。

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

3)     安装docker-ce。

sudo yum install docker-ce docker-ce-cli containerd.io

 

这个命令总是会安装最新版本的docker-ce,如果需要安装指定版本的可以参考下面的操作:

sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io

方式二:下载软件包进行安装

1)     通过https://download.docker.com/linux/centos/7/aarch64/stable/Packages/,下载指定版本的软件包。

2)     执行命令安装软件包及依赖。

 

“package.rpm”为下载的软件包。

sudo yum install /path/to/package.rpm

3.      启动软件

1)     启动Docker。

sudo systemctl start docker

2)     使用一个hello-world镜像验证Docker是否正常。

sudo docker run hello-world

回显内容如下:

Unable to find image 'hello-world:latest' locally 
latest: Pulling from library/hello-world 
3b4173355427: Pull complete  
Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8 
Status: Downloaded newer image for hello-world:latest 
  
Hello from Docker! 
This message shows that your installation appears to be working correctly. 
  
To generate this message, Docker took the following steps: 
 1. The Docker client contacted the Docker daemon. 
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 
    (arm64v8) 
 3. The Docker daemon created a new container from that image which runs the 
    executable that produces the output you are currently reading. 
 4. The Docker daemon streamed that output to the Docker client, which sent it 
    to your terminal. 
  
To try something more ambitious, you can run an Ubuntu container with: 
 $ docker run -it ubuntu bash 
  
Share images, automate workflows, and more with a free Docker ID: 
 https://hub.docker.com/ 
  
For more examples and ideas, visit: 
 https://docs.docker.com/get-started/

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值