https://segmentfault.com/a/1190000021593244
另一种安装方式 https://blog.csdn.net/u011333324/article/details/100181104 (推荐)
https://blog.csdn.net/bashendixie5/article/details/109525871

  1. $ yum install -y yum-utils \
  2. yum install -y device-mapper-persistent-data \
  3. yum install -y lvm2
  4. yum install -y docker
  5. systemctl start docker
  6. systemctl status docker
  7. docker version

开机自启 sudo systemctl enable docker

docker-compose安装
yum install -y docker-compose-plugin
docker compose version
或者

  1. 运行以下命令以下载 Docker Compose 的当前稳定版本:
  2. $ sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  3. 要安装其他版本的 Compose,请替换 1.24.1
  4. // https://github.com/docker/compose/releases?page=16 docker-compose-Linux-x86_64
  5. 将可执行权限应用于二进制文件:
  6. $ sudo chmod +x /usr/local/bin/docker-compose
  7. 创建软链:
  8. $ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
  9. 测试是否安装成功:
  10. $ docker-compose --version
  11. cker-compose version 1.24.1, build 4667896b

1.报错:docker启动失败

Failed to start Docker Application Container Engine.

修改 /etc/docker/daemon.json 加上如下的键值:

  1. {
  2. "registry-mirrors": ["https://registry.docker-cn.com"]
  3. }

然后重启docker即可 systemctl start docker
参考:https://blog.csdn.net/qq_43159578/article/details/123417292

2.没有可用软件包 docker-ce

https://blog.csdn.net/weixin_45764765/article/details/125240288

3.镜像加速
https://blog.csdn.net/weixin_47556601/article/details/123316884

  1. vim /etc/docker/daemon.json
  2. {
  3. "registry-mirrors": ["https://17o3zxc0.mirror.aliyuncs.com"]
  4. }
  5. //重启镜像
  6. systemctl daemon-reload
  7. systemctl restart docker.service