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
相关推荐
❀͜͡傀儡师9 小时前
centos 7部署dns服务器
linux·服务器·centos·dns
_运维那些事儿11 小时前
VM环境的CI/CD
linux·运维·网络·阿里云·ci/cd·docker·云计算
lpruoyu13 小时前
【Docker进阶-05】Docker网络
网络·docker·容器
人间打气筒(Ada)14 小时前
k8s:CNI网络插件flannel与calico
linux·云原生·容器·kubernetes·云计算·k8s
江畔何人初15 小时前
pod的内部结构
linux·运维·云原生·容器·kubernetes
三块钱079415 小时前
群晖docker部署Mattermost,对接openclaw
运维·docker·容器
周航宇JoeZhou17 小时前
JB2-7-HTML
java·前端·容器·html·h5·标签·表单
苦逼IT运维18 小时前
从 0 到 1 理解 Kubernetes:一次“破坏式”学习实践(一)
linux·学习·docker·容器·kubernetes
萧曵 丶18 小时前
Docker 面试题
运维·docker·容器
晨港飞燕18 小时前
容器,pod,节点概念
容器