添加docker的yum源

CentOS7.9

# 国外的源
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

# 国内阿里源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

Rocky Linux9.x

# 安装所需的依赖包
dnf install -y dnf-utils
# 添加 Docker 的官方 GPG 密钥:
dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

安装docker

yum install -y docker-ce docker-ce-cli container.io

启动docker服务并配置docker服务开机自动启动

systemctl enable --now docker

查看docker版本信息

docker version

Client: Docker Engine - Community
 Version:           20.10.16
 API version:       1.41
 Go version:        go1.17.10
 Git commit:        aa7e414
 Built:             Thu May 12 09:19:45 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

搞定

Rocky linux系统参考: dnf安装docker


YYGP
25 声望11 粉丝

写BUG