ARTICLE · INTELLIGENCE

战地情报 · 详情页

来自尧图项目组的一线实战观察与深度解析

centos9 安装docker engine

centos9 安装docker engine

查看是否具有历史版本的docker

命令

rpm -qa | grep -E 'docker|containerd|podman'

运行结果

我的镜像有安装podman,这里需要卸载

卸载历史版本

命令

dnf remove -y docker-ce docker-ce-cli containerd.io podman

运行结果

安装docker环境

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

添加 Docker 官方仓库

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

安装docker

dnf install -y docker-ce docker-ce-cli containerd.io

配置国内镜像

mkdir -p /etc/docker vi /etc/docker/daemon.json

将如下json粘贴进入daemon.json中

{ "registry-mirrors": [ "https://e2zfh98i.mirror.aliyuncs.com", "https://mirror.baidubce.com", "https://docker.mirrors.ustc.edu.cn", "https://docker-cf.registry.cyou", "https://dockercf.jsdelivr.fyi", "https://docker.jsdelivr.fyi", "https://dockertest.jsdelivr.fyi", "https://dockerproxy.com", "https://docker.m.daocloud.io", "https://docker.nju.edu.cn", "https://docker.mirrors.sjtug.sjtu.edu.cn", "https://mirror.iscas.ac.cn", "https://docker.rainbond.cc", "https://do.nark.eu.org", "https://dc.j8.work", "https://dockerproxy.com", "https://gst6rzl9.mirror.aliyuncs.com", "https://registry.docker-cn.com", "http://hub-mirror.c.163.com", "http://mirrors.ustc.edu.cn/", "https://mirrors.tuna.tsinghua.edu.cn/", "http://mirrors.sohu.com/" ], "debug": true, "experimental": false }

启动docker

启动docker

systemctl start docker

运行hello-world镜像

docker run hello-world

看到如下截图代表成功

RELATED READING

延伸阅读

更多一线实战笔记与深度复盘,助您持续精进