在 CentOS 上快速安装 Docker,可以按照以下步骤进行:
1. 更新系统:
bash
sudo yum update
2. 安装 Docker:
bash
sudo yum install docker
3. 启动 Docker 服务:
bash
sudo systemctl start docker
4. 设置 Docker 开机自启动:
bash
sudo systemctl enable docker
5. 验证 Docker 是否安装成功:
bash
sudo docker version
安装完成后,您就可以使用 Docker 运行和管理容器了。
输出
bash
$ sudo docker version
Client: Docker Engine - Community
Version: 24.0.5
API version: 1.43
Go version: go1.20.6
Git commit: ced0996
Built: Fri Jul 21 20:39:02 2023
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 24.0.5
API version: 1.43 (minimum version 1.12)
Go version: go1.20.6
Git commit: a61e2b4
Built: Fri Jul 21 20:38:05 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.21
GitCommit: 3dce8eb055cbb6872793272b4f20ed16117344f8
runc:
Version: 1.1.7
GitCommit: v1.1.7-0-g860f061
docker-init:
Version: 0.19.0
GitCommit: de40ad0