虚机docker下不了镜像

佬友们有遇到过吗?配置就国内镜像源或者配置了系统代理到自己主机的科学上网了。但是不管哪种在下载镜像时,总是下载到50多mb就报错了,如下



两台虚机都是用VMware部署的,搞不懂,头晕

4 个赞

一般都是网络原因吧

是,但是已经没有思路了。系统代理和国内镜像源都试了都不行。看看有没有有大佬有经验,可能是某个网络设置有问题。

碰到过类似的,换代理尝试后成功。

docker daemon不走系统代理的,从报错看也没有走镜像,是不是没重启docker服务啊

修改/etc/docker/daemon.json 设置俄罗斯国家的镜像

{
  "registry-mirrors": [
    "https://docker.1panelproxy.com",
    "https://2a6bf1988cb6428c877f723ec7530dbc.mirror.swr.myhuaweicloud.com",
    "https://docker.m.daocloud.io",
    "https://hub-mirror.c.163.com",
    "https://mirror.baidubce.com",
    "https://your_preferred_mirror",
    "https://dockerhub.icu",
    "https://docker.registry.cyou",
    "https://docker-cf.registry.cyou",
    "https://dockercf.jsdelivr.fyi",
    "https://docker.jsdelivr.fyi",
    "https://dockertest.jsdelivr.fyi",
    "https://mirror.aliyuncs.com",
    "https://dockerproxy.com",
    "https://mirror.baidubce.com",
    "https://docker.m.daocloud.io",
    "https://docker.nju.edu.cn",
    "https://docker.mirrors.sjtug.sjtu.edu.cn",
    "https://docker.mirrors.ustc.edu.cn",
    "https://mirror.iscas.ac.cn",
    "https://docker.rainbond.cc"
  ]
}

//改完要重启docker
sudo systemctl daemon-reload 
sudo systemctl restart docker
1 个赞


尝试ing……

还是失败了

我现在用的 “registry-mirrors”: [
https://docker.hlmirror.com”,
https://docker-0.unsee.tech”,
https://hubp.me”,
https://docker-mirror.aigc2d.com”,
https://lispy.org”,
https://docker.1ms.run
],目前都能用,实在不行就本地加载吧

佬,麻烦看下下面一条评论,配置后,报错信息是表示还是没有走镜像源吗?

没代理成功?你都开代理了就去请求源头不请求国内镜像了呗

这是本地电脑装虚拟机?那你在虚拟机 curl 一下 fackbook.com 看代理有没生效先。

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
    "registry-mirrors": [
        "https://mirror.ccs.tencentyun.com",
        "https://registry.cn-hangzhou.aliyuncs.com",
        "https://do.nark.eu.org",
        "https://dc.j8.work",
        "https://docker.m.daocloud.io",
        "https://dockerproxy.com",
        "https://docker.mirrors.ustc.edu.cn",
        "https://docker.nju.edu.cn",
        "https://hub-mirror.c.163.com",
        "https://mirror.baidubce.com"
    ]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

下载镜像失败,连接不上的时候,临时取消代理

env -u http_proxy -u https_proxy apt-get download docker-ce docker-ce-cli containerd.io

取消代理

unset http_proxy
unset https_proxy

我基本是这么解决的

1 个赞

配置代理后从github拉取docker-compose文件是成功的

1 个赞

配置之后也是一样


总是有几个能下成功,而且下载速度很快但是到这个600多m的时候就会失败,前面那几个应该是50Mb左右,下载很快。

可以去阿里云镜像,自己搭一个小的镜像站,然后配置阿里云镜像地址来拉

这种情况建议直接宿主机下完tar包导进去吧佬,不然就钻进牛角尖啦!网络的问题让网管来整 :rofl:

1 个赞

已经在本地下载了,垃圾本机安装docker又说wsl太老,没得用。最后让朋友帮我下了发我,害。

我的意思是直接去官网下镜像的tar包然后把文件丢到虚拟机里直接import镜像呀佬,不用装wsl呀佬。
不知道是不是我理解的有误可以试试看 :saluting_face:

一般是网络问题,要么代理的质量不行,要么没有完全走代理。

cat > /etc/systemd/system/containerd.service.d/http-proxy.conf<<EOF

[Service]
#代理地址
Environment=“HTTP_PROXY=http://192.168.231.2:7890” 【宿主机clash】
Environment=“HTTPS_PROXY=http://192.168.231.2:7890
Environment=“NO_PROXY=127.0.0.1,localhost,10.0.0.0/8,192.168.0.0/16,10.96.0.0/12”
EOF

这个是之前我用containerd配的代理配置,docker应该也是一样的,可以找找看有没有类似的文件夹,佬

自己搭建一个私有镜像:配置环境变量 https_proxy 部署 registry,然后所有安装 docker 到虚拟机配置 registry-mirrors 指定刚才的 registry 地址。
应急可以在能正常 pull 镜像的机器上使用 docker image save 生成 tar 文件,上传到服务器上用 docker image load 加载。