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
    评论
要在华为云安装Docker,可以按照以下步骤进行操作: 1. 卸载老版本的Docker:如果在服务器上已经安装了旧版本的Docker(如“docker”、“docker.io”或“docker-engine”),需要先卸载掉。可以使用命令sudo apt-get remove docker docker-engine docker.io进行卸载。 2. 更新系统:为了确保系统是最新的,可以运行以下命令进行系统更新:sudo apt-get update && sudo apt-get upgrade。 3. 安装Docker:使用以下命令安装Docker的最新版本:sudo apt-get install docker-ce docker-ce-cli containerd.io。 4. 启动Docker服务:安装完成后,可以使用以下命令启动Docker服务:sudo systemctl start docker。 5. 配置镜像加速:为了加速Docker镜像的下载速度,可以配置Docker镜像加速器。可以按照华为云提供的文档进行配置。 6. 验证安装:使用以下命令验证Docker是否成功安装docker version或docker info。 通过以上步骤,您就可以在华为云上成功安装配置Docker环境了。请确保您遵循官方文档中提供的详细指导,以获得更准确和最新的安装步骤。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [Docker安装配置华为云官方解决方案](https://blog.csdn.net/qq_43308275/article/details/112860026)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [华为云之HECS云服务器配置docker环境](https://blog.csdn.net/jks212454/article/details/128906084)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值