Docker 安装部署(CentOS 8)

以下所有操作都是基于 CentOS 8 系统进行操作的。安装的 Docker 版本为 25.0.5-1.el8。

1、卸载老版本 Docker

shell 复制代码
sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

注:如果是之前未安装过了忽略此步

2、设置 Docker 安装源

shell 复制代码
# 安装 yum-utils,如果已安装可以忽略
sudo yum install -y yum-utils
# 以下为国内镜像,可以提升下载速度
sudo yum-config-manager --add-repo https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo

3、查看镜像源中可安装的版本

shell 复制代码
yum list docker-ce --showduplicates | sort -r

4、选择指定的版本(25.0.5-1.el8)进行安装

shell 复制代码
sudo yum install -y docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io docker-buildx-plugin docker-compose-plugin

选择指定的版本号替换<VERSION_STRING>,如我的安装是25.0.5-1.el8

shell 复制代码
sudo yum install -y docker-ce-25.0.5-1.el8 docker-ce-cli-25.0.5-1.el8 containerd.io docker-buildx-plugin docker-compose-plugin

5、设置 Docker 镜像源

shell 复制代码
sudo cat >> /etc/docker/daemon.json << EOF
{
    "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"]
}
EOF

6、加载服务配置,并使其生效

shell 复制代码
sudo systemctl daemon-reload

7、启动 Docker 服务

shell 复制代码
sudo systemctl restart docker

8、查看 Docker 信息

shell 复制代码
sudo docker info
shell 复制代码
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.6.3-docker)
  compose: Docker Compose (Docker Inc., v2.27.0)
  scan: Docker Scan (Docker Inc., v0.23.0)

Server:
 Containers: 40
  Running: 16
  Paused: 0
  Stopped: 24
 Images: 13
 Server Version: 20.10.9
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8b3b7ca2e5ce38e8f31a34f35b2b68ceb8470d89
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-1160.el8.x86_64
 Operating System: CentOS Linux 8 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 3.682GiB
 Name: k8s
 ID: OGWE:A4BS:MOWR:VQUY:6Q7D:I5E6:4ZCW:JC3Z:G2PW:3P7X:F3YR:F62Q
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://docker.mirrors.ustc.edu.cn/
 Live Restore Enabled: false
相关推荐
虎头金猫40 分钟前
如何在群晖NAS上通过Docker部署CloudSaver?群晖部署CloudSaver教程|聚合资源搜索并实现远程访问
运维·服务器·网络·python·docker·容器·pandas
holidaypenguin7 小时前
Docker 前端本地开发指南(实操版)
docker
fatcoder8 小时前
玩转Docker 08 — 实战:容器化真实后端并编排
后端·docker·容器
vortex510 小时前
Container Desktop 安装与配置指南
docker
江湖有缘12 小时前
5款开源wiki知识库工具,支持Docker快速部署!
docker·容器·开源
云上飞4763696213 小时前
Windows WSL2 + Docker 环境下NVIDIA PhysicsNeMo 安装指南
windows·docker·physicsai·physicsnemo
抓不住时间的沙13 小时前
N1搭建Hexo个人博客,部署到Github
python·docker·node.js·debian·github·arm
☆凡尘清心☆14 小时前
CentOS Stream 9 源码编译搭建 Zabbix7.0.29 完整部署方案(部署成功)
linux·运维·centos
2401_8346369914 小时前
保姆级 K8s 运维:RBAC 认证 + Dashboard+Local/NFS 动态卷实战
运维·容器·kubernetes
wsad053214 小时前
CentOS 10 上使用 Docker Compose 部署 Discuz X5.0 论坛完整教程
linux·docker·centos·discuz