Rocky Linux9.2部署docker🌀
Rocky Linux9.2部署docker🌀
官网文档:https://docs.docker.com/engine/install/
如有旧版本,请先卸载旧版本:
sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
1. 安装依赖
[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
2. 配置docker源
# 官方源
[root@localhost ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# 阿里源
[root@localhost ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3. 安装docker引擎
# 列出docker版本
[root@localhost ~]# yum list docker-ce --showduplicates | sort -r docker-ce.x86_64 3:24.0.2-1.el9 docker-ce-stable docker-ce.x86_64 3:24.0.1-1.el9 docker-ce-stable docker-ce.x86_64 3:24.0.0-1.el9 docker-ce-stable docker-ce.x86_64 3:23.0.6-1.el9 docker-ce-stable docker-ce.x86_64 3:23.0.5-1.el9 docker-ce-stable docker-ce.x86_64 3:23.0.4-1.el9 docker-ce-stable docker-ce.x86_64 3:23.0.2-1.el9 docker-ce-stable docker-ce.x86_64 3:23.0.1-1.el9 docker-ce-stable docker-ce.x86_64 3:23.0.0-1.el9 docker-ce-stable docker-ce.x86_64 3:20.10.24-3.el9 docker-ce-stable docker-ce.x86_64 3:20.10.23-3.el9 docker-ce-stable docker-ce.x86_64 3:20.10.22-3.el9 docker-ce-stable docker-ce.x86_64 3:20.10.21-3.el9 docker-ce-stable docker-ce.x86_64 3:20.10.20-3.el9 docker-ce-stable docker-ce.x86_64 3:20.10.19-3.el9 docker-ce-stable docker-ce.x86_64 3:20.10.18-3.el9 docker-ce-stable docker-ce.x86_64 3:20.10.17-3.el9 docker-ce-stable docker-ce.x86_64 3:20.10.16-3.el9 docker-ce-stable docker-ce.x86_64 3:20.10.15-3.el9 docker-ce-stable Docker CE Stable - x86_64 30 kB/s | 27 kB 00:00 Available Packages
# 安装最新版
[root@localhost ~]# yum -y install docker-ce docker-ce-cli containerd.io
4. 查看版本
[root@localhost ~]# docker -v Docker version 24.0.2, build cb74dfc
5. 设置开机自启
[root@localhost ~]# systemctl enable --now docker
6. 配置镜像加速
[root@localhost ~]# vim /etc/docker/daemon.json { "registry-mirrors": ["http://hub-mirror.c.163.com"] }
7. 重载docker服务
[root@localhost ~]# systemctl daemon-reload && systemctl restart docker