1.我们要安装的是dockerengine,而不是docker desktop。点击下面的链接进入Docker Engine->install->Centos
2. 用root用户安装repository
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
3. 开始安装docker engine
sudo yum install docker-ce docker-ce-clicontainerd.io docker-buildx-plugin docker-compose-plugin
4. 启动docker
sudo systemctl start docker
5. 查看docker 镜像是否启动成功,出现表头代表安装成功
docker images
6. 设置docker开机自启动作为后台进程
sudo systemctl enable docker
7. docker下载镜像默认从国外网址docker hub下载,为了加快下载docker镜像速度,给docker配置阿里云的镜像加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json<<-'EOF' { "registry-mirrors":["https://l7bu3hhu.mirror.aliyuncs.com"] } EOF
sudo systemctldaemon-reload sudo systemctl restart docker