docker镜像加速

针对近期docker镜像库无法访问的问题(即docker pull拉取超时),下面介绍2种缓解方案:

配置docker国内镜像加速

  • 阿里云华为云 的容器镜像服务,会为每一个账号生成一个专属的镜像加速器地址,下面是一些国内好用的镜像加速器地址
阿里云-加速器地址:https://<你的ID>.mirror.aliyuncs.com
华为云-加速器地址:https://<你的ID>.mirror.swr.myhuaweicloud.com
腾讯云-加速器地址:https://mirror.ccs.tencentyun.com
网易云-加速器地址:https://hub-mirror.c.163.com/
七牛云-加速器地址:https://reg-mirror.qiniu.com/
中科大-加速器地址:https://docker.mirrors.ustc.edu.cn/
清华大学-加速器地址:https://mirrors.tuna.tsinghua.edu.cn
  • 下面以阿里云为例,配置国内镜像加速:
mkdir -p /etc/docker
echo '{ "registry-mirrors": ["https://bftllzk2.mirror.aliyuncs.com"] }' > /etc/docker/damon.json
systemctl daemon-reload
systemctl restart docker

#.测试一下
docker pull nginx

利用vpn配置docker代理

  • 利用某宝买来的vpn做转发,以实现docker镜像加速,示例 Trojan 启用 Share Over LAN

  • 先配置vpn暴露的 Http Port 为docker代理服务端口,再重启docker服务
mkdir -p /etc/systemd/system/docker.service.d
echo '[Service]' > /etc/systemd/system/docker.service.d/http_proxy.conf
echo 'Environment="HTTP_PROXY=192.168.20.183:58591"' >> /etc/systemd/system/docker.service.d/http_proxy.conf
echo 'Environment="HTTPS_PROXY=192.168.20.183:58591"' >> /etc/systemd/system/docker.service.d/http_proxy.conf
systemctl daemon-reload
systemctl restart docker

#.测试一下
docker pull nginx
Copyright © www.sqlfans.cn 2023 All Right Reserved更新时间: 2024-06-18 10:36:24

results matching ""

    No results matching ""