1;先用lsb查看系统
[root@localhost ~]# lsb_release -a ##需要安装lsb
LSB Version: n/a
Distributor ID: openEuler
Description: openEuler release 23.09
Release: 23.09
Codename: n/a
2;添加源需要修改vi /etc/yum.repos.d/docker-ce.repo
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/debug-$basearch/stable
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/source/stable
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-test-debuginfo]
name=Docker CE Test - Debuginfo $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/debug-$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-test-source]
name=Docker CE Test - Sources
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/source/test
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-nightly]
name=Docker CE Nightly - $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-nightly-debuginfo]
name=Docker CE Nightly - Debuginfo $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/debug-$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-nightly-source]
name=Docker CE Nightly - Sources
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/source/nightly
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
3;更新yum缓存
sudo yum makecache
4;安装启动即可
sudo yum install docker-ce docker-ce-cli containerd.io
systemctl start docker.service
5;检测
sudo docker run hello-world
docker -v
此简化配置来源openEuler安装Docker和踩坑分析_openeuler 所有的坑-CSDN博客
镜像加速配置
1. 安装/升级容器引擎客户端
推荐安装1.11.2以上版本的容器引擎客户端
2. 加速器地址
https://4191b026bcf646a7b2be600018054f3b.mirror.swr.myhuaweicloud.com
3,针对容器引擎客户端版本大于 1.11.2 的用户
以root用户登录容器引擎所在的虚拟机
修改“/etc/docker/daemon.json”文件(如果没有,可以手动创建),在该文件内添加如下内容:
vi /etc/docker/daemon.json
{
"registry-mirrors": [ "https://4191b026bcf646a7b2be600018054f3b.mirror.swr.myhuaweicloud.com" ]
}
4. 重启容器引擎
配置完成后,执行systemctl restart docker重启容器引擎。 如果重启失败,则检查操作系统其他位置(如:/etc/sysconfig/docker、/etc/default/docker)是否配置了registry-mirrors参数,删除此参数并重启容器引擎即可。
5. 确认配置结果
执行docker info,当Registry Mirrors字段的地址为加速器的地址时,说明加速器已经配置成功