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
相关推荐
SpikeKing11 分钟前
Server - 使用 Docker 配置 PyTorch 研发环境
pytorch·docker·llm
云道轩1 小时前
升级centos 7.9内核到 5.4.x
linux·运维·centos
斯普信云原生组2 小时前
Docker构建自定义的镜像
java·spring cloud·docker
2201_761199042 小时前
k8s4部署
云原生·容器·kubernetes
小柏ぁ2 小时前
calico/node is not ready: BIRD is not ready: BGP not established with xxx
运维·docker·kubernetes
三劫散仙3 小时前
kubernetes jenkins pipeline优化拉取大仓库性能指定分支+深度
容器·kubernetes·jenkins
西京刀客3 小时前
k8s热更新-subPath 不支持热更新
云原生·容器·kubernetes·configmap·subpath
weixin_434936284 小时前
k8S 命令
linux·容器·kubernetes
nuczzz6 小时前
GPU虚拟化
docker·kubernetes·k8s·gpu·nvidia
fengyehongWorld6 小时前
Linux Docker的简介
linux·docker