以下所有操作都是基于 CentOS 8 系统进行操作的。安装的 Docker 版本为 25.0.5-1.el8。
1、卸载老版本 Docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
注:如果是之前未安装过了忽略此步
2、设置 Docker 安装源
# 安装 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、查看镜像源中可安装的版本
yum list docker-ce --showduplicates | sort -r
4、选择指定的版本(25.0.5-1.el8)进行安装
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
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 镜像源
sudo cat >> /etc/docker/daemon.json << EOF
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"]
}
EOF
6、加载服务配置,并使其生效
sudo systemctl daemon-reload
7、启动 Docker 服务
sudo systemctl restart docker
8、查看 Docker 信息
sudo docker info
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
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » Docker 安装部署(CentOS 8)
发表评论 取消回复