如果docker已将安装好
参考:https://github.com/cmliu/CF-Workers-docker.io
sudo mkdir -p /etc/dockercd /etc/dockersudo vim daemon.json#输入以下内容{ "registry-mirrors": ["https://docker.fxxk.dedyn.io"] } #重启docker服务sudo systemctl daemon-reloadsudo systemctl restart docker#试验是否可以正常拉取镜像,若可以拉取则设置成功
如果docker还没安装
uname -ryum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum install docker-ce docker-ce-cli containerd.io -y systemctl start dockersystemctl enable dockerdocker version docker images
其中镜像可以尝试换换
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo https://docker.fxxk.dedyn.io
docker更换国内镜像源
1.通过 vi/vim 进入/etc/docker/daemon.json,如果没有这个文件,需要在/etc/docker目录下手动进行创建这个目录,然后写入一下的内容.
{ "builder": { "gc": { "defaultKeepStorage": "20GB", "enabled": true } }, "experimental": true, "features": { "buildkit": true }, "insecure-registries": [ "172.24.86.231" ], "registry-mirrors": [ "https://dockerproxy.com", "https://mirror.baidubce.com", "https://ccr.ccs.tencentyun.com", "https://docker.m.daocloud.io", "https://docker.nju.edu.cn", "https://docker.mirrors.ustc.edu.cn" ], "log-driver":"json-file", "log-opts": { "max-size":"500m", "max-file":"3" }}
输入:wq保存并退出
2.保存 /etc/docker/daemon.json systemctl daemon-reload systemctl restart docker
启动和校验 常用操作# 启动Dockersystemctl start docker # 停止Dockersystemctl stop docker # 重启systemctl restart docker # 设置开机自启systemctl enable docker
打赏
支付宝微信扫一扫,打赏作者吧~
本文链接:https://www.kinber.cn/post/4611.html 转载需授权!
推荐本站淘宝优惠价购买喜欢的宝贝: