
[root@DESKTOP-4ER0J8T /]# yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo
[root@DESKTOP-4ER0J8T /]# yum install docker-ce docker-ce-cli containerd.io
安装报错 多运行 yum install docker-ce docker-ce-cli containerd.io 几次 总能成功 (本人运行了10几次 才成功)
最终安装docker 版本
[root@DESKTOP-4ER0J8T /]# docker -v
启动
[root@DESKTOP-4ER0J8T /]# systemctl start docker
[root@DESKTOP-4ER0J8T /]# systemctl status docker
运行 查看docker 运行状态
尝试搜索redis 完美的搜索不到任何镜像
修改docker镜像仓库地址
[root@DESKTOP-4ER0J8T /]# vim /etc/docker/daemon.json
创建或修改 /etc/docker/daemon.json 文件,修改为如下形式:
{ "registry-mirrors": [ "https://registry.docker-cn.com", "http://hub-mirror.c.163.com", "https://docker.mirrors.ustc.edu.cn" ] }
Docker中国区官方镜像:https://registry.docker-cn.com
网易:http://hub-mirror.c.163.com
ustc:https://docker.mirrors.ustc.edu.cn
中国科技大学:https://docker.mirrors.ustc.edu.cn
阿里云容器镜像服务:https://cr.console.aliyun.com/
腾讯云容器镜像服务:https://cloud.tencent.com/product/tke
华为云容器镜像服务:https://www.huaweicloud.com/product/cci.html
完美的还是不能用 全部报废~
最终现在能用 可能后面也不能用:
[root@DESKTOP-4ER0J8T /]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.m.daocloud.io","https://docker.1panel.live","https://hub.rat.dev"]
}
如果启动报错如下:
systemctl start docker
Job for docker.service failed because the control process exited with error code. See “systemctl status docker.service” and “journalctl -xe” for details.
检查 daemon.json文件 一定是标准的 json 格式,不能有 多余的空格 ,这个错误就是 daemon.json 文件里面有 多余的 东西 或者格式有问题
重启 docker
[root@DESKTOP-4ER0J8T /]# systemctl restart docker.service
[root@DESKTOP-4ER0J8T /]# systemctl restart docker
查看 docker info 信息
[root@DESKTOP-4ER0J8T /]# docker info #镜像源更换成功
因为命令搜索不出来 只能上蔷, 到 https://hub.docker.com/ 上搜索 自己需要的镜像
比方说mysql:复制下来 pull
===================================== 安装 redis =======================================================================
拉取redis 最新镜像
[root@DESKTOP-4ER0J8T /]# docker pull redis
查看镜像包
[root@DESKTOP-4ER0J8T /]# docker images
创建本地redis挂载