Docker群晖docker查询注册表失败

解决群晖NAS UI(或SSH中)的docker pull错误(无法拉取, 注册表错误)

有什么用

image-20240715213450500

1
2
3
error pulling image configuration: Get "https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/...

dial tcp 128.242.250.148:443: i/o timeout

该方法适用于:

image-20240715222232393

怎么用

群晖 7.1 和 7.1.1,没有 ContainerManager ,Mac 上开 clash 允许 Lan 访问,配置下代理:

目录:/usr/local/lib/systemd/system

vim pkg-Docker-dockerd.service

1
2
3
4
[Service]
Environment="HTTP_PROXY=http://192.168.1.10:7890"
Environment="HTTPS_PROXY=http://192.168.1.10:7890"
Environment="NO_PROXY=localhost,127.0.0.1"

(请根据自己情况,适当修改这个文件内容)

systemctl daemon-reload
systemctl restart pkg-Docker-dockerd

测试成功,测试过程如下:

1
2
3
4
5
6
7
8
9
root@DS918:/usr/local/lib/systemd/system# docker pull ryjer/opentracker                                             
Using default tag: latest
latest: Pulling from ryjer/opentracker
661ff4d9561e: Pull complete
f29ffd230948: Pull complete
e72e6a981102: Pull complete
Digest: sha256:67db529ec69573ab3bee534b75c4e9ac9374b78e7ac386f1286a77be7ad346e3
Status: Downloaded newer image for ryjer/opentracker:latest
docker.io/ryjer/opentracker:latest

相关内容

实现方法

通过ssh命令控制重启Docker服务或者直接重启机器

NAS停用Docker套件

1
bash /var/packages/Docker/scripts/start-stop-status stop

NAS开启Docker套件

1
bash /var/packages/Docker/scripts/start-stop-status start

老版本的群晖NAS

方法一:

  1. 添加 /etc/docker/env 文件
    export HTTP_PROXY=127.0.0.1:8899

  2. 编辑 /etc/init/pkg-Docker-dockerd.conf 文件

    exec /var/packages/Docker/target/usr/bin/dockerd –config-file /var/packages/Docker/etc/dockerd.json
    改为

#exec /var/packages/Docker/target/usr/bin/dockerd –config-file /var/packages/Docker/etc/dockerd.json
script
source /etc/docker/env
/var/packages/Docker/target/usr/bin/dockerd –config-file /var/packages/Docker/etc/dockerd.json
end script

  1. 然后,重启 docker 服务,
    1. 停止 docker
      1. /var/packages/Docker/scripts/start-stop-status stop
    2. 启动 docker
      1. /var/packages/Docker/scripts/start-stop-status start

接着,你就尽情的 pull 吧,速度拉满

方法二:

  1. 删除 NAS 》 控制面板 》网络 》代理服务器
  2. 手动配置DNS服务器
    1. 223.5.5.5
    2. 114.114.114.114
  3. 设置 Docker 》 注册表 》设置
    1. https://registry.cn-hangzhou.aliyuncs.com/
    2. https://docker.nju.edu.cn
  4. 清空 /etc/docker/daemon.json

方法三:

测试拉取失败:https://dockerproxy.com/

旧版本的pkg-Docker-dockerd.service

cat pkg-Docker-dockerd.service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[Unit]                                                                                                              
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
IgnoreOnIsolate=true
DefaultDependencies=no

[Service]
Type=notify
ExecStart=/var/packages/Docker/target/usr/bin/dockerd --config-file /var/packages/Docker/etc/dockerd.json
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=always
RestartSec=2
TimeoutSec=0
StartLimitBurst=3
StartLimitInterval=60s

[X-Synology]

灵感来源

怎样才能让我的 docker 走代理

群晖的 Docker 无法使用系统代理拉取镜像

关键字:群晖 docker daemon http proxy 配置

个性化需求沟通 扫客服加V加群: