官方步骤
[[email protected] ~]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core)
(若之前没装过,此步省略)
/
表示连接符而已
yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
yum install -y gcc yum install -y gcc-c++
yum install -y yum-utils
# 官方的(不推荐,国内网速不友好) yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo # 阿里云yyds yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
systemctl start docker
[[email protected] ~]# ps -df | grep docker root 5768 5203 0 23:20 pts/1 00:00:00 grep --color=auto docker [[email protected] ~]# ps -ef | grep docker root 5649 1 1 23:20 ? 00:00:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock root 5770 5203 0 23:20 pts/1 00:00:00 grep --color=auto docker
[[email protected] ~]# docker version Client: Docker Engine - Community Version: 20.10.17 API version: 1.41 Go version: go1.17.11 Git commit: 100c701 Built: Mon Jun 6 23:05:12 2022 OS/Arch: linux/amd64 Context: default Experimental: true Server: Docker Engine - Community Engine: Version: 20.10.17 API version: 1.41 (minimum version 1.12) Go version: go1.17.11 Git commit: a89b842 Built: Mon Jun 6 23:03:33 2022 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.7 GitCommit: 0197261a30bf81f1ee8e6a4dd2dea0ef95d67ccb runc: Version: 1.1.3 GitCommit: v1.1.3-0-g6724737 docker-init: Version: 0.19.0 GitCommit: de40ad0
systemctl stop docker yum remove docker-ce docker-ce-cli containerd.io docker-compose-plugin rm -rf /var/lib/docker sudo rm -rf /var/lib/containerd
注:当然不一定要用阿里云的镜像,也可以用国内其它的镜像
注册阿里云账号——>控制台——>菜单——>容器镜像服务
个人学习,就选了个人实例
创建之后,点击镜像工具——>镜像加速器