Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker daemon 代理使用 #172

Open
lozn00 opened this issue Aug 8, 2023 · 23 comments
Open

docker daemon 代理使用 #172

lozn00 opened this issue Aug 8, 2023 · 23 comments

Comments

@lozn00
Copy link

lozn00 commented Aug 8, 2023

因为最近拉不下来东西, 代理也不走,头大啊 而且最后的错误永远是官方镜像源的错误

@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

大佬在吗? 为啥代理怎么都不走,我配置deason.json也没用,配置手动创建一个 目录 也没用, 配置 shell 环境变量的不走, 但是我opkg update是走代理的,我能看到流量数据

@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

各种配置都用过了不行

/etc/systemd/system/docker.service.d# dockerd
unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives don't match any configuration option: https, http

加default节点也不行

@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

在 /etc/systemd/system/docker.service.d/http-proxy.conf配置代理也不行

@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

image
最后永远都是这个错误,无奈啊,这网络是正常的,代理就是不走

@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

  GNU nano 7.2                          http-proxy.conf
 [Service]
 Environment="HTTP_PROXY=http://192.168.2.54:1079"
 Environment="HTTPS_PROXY=http://192.168.2.54:1079"
 #Environment="NO_PROXY="localhost,127.0.0.1,::1"






@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

root@OpenWrt:/etc/systemd/system/docker.service.d# docker --version
Docker version 24.0.5, build ced0996
root@OpenWrt:/etc/systemd/system/docker.service.d# dockerd --version
Docker version 20.10.17, build a89b842
root@OpenWrt:/etc/systemd/system/docker.service.d#

@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

镜像也是废的,虽然识别/etc/docker/daemon.json但是不走,一直是这个错误


{
  "registry-mirrors":  [  "https://registry.docker-cn.com"],
  "proxies": {



   "http": "http://your-proxy-server:proxy-port",
    "https": "http://your-proxy-server:proxy-port"
  }
}







或者


{
  "registry-mirrors":  [  "https://registry.docker-cn.com"],
  "proxies": {
"default":{
   "http": "http://your-proxy-server:proxy-port",
    "https": "http://your-proxy-server:proxy-port"

  }
}

dockerd 运行 提示
/etc/systemd/system/docker.service.d# dockerd
unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives don't match any configuration option: https, http

/etc/systemd/system/docker.service.d# dockerd
unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives don't match any configuration option: default

@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

我也尝试过在无root下配置cd ~/.config/systemd/user/docker.service.d 配置 http-proy.conf依然不走代理。

@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

image

@lisaac
Copy link
Owner

lisaac commented Aug 9, 2023

他应该需要的是http代理,你的代理正确吗

@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

代理百分百正确 ,在shell里面配置正常的,但是 不走, 我尝试过网上各种docker配置代理方法也搞不定

@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

image
这代表linux shell是正常的,
@lisaac

@lisaac
Copy link
Owner

lisaac commented Aug 9, 2023

你现在是改了 proxy 后 dockerd 启动出问题?还是启动没问题,无法生效?

@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

docker启动正常呀,就是永远都拉取不了 东西呀,这变成离线版本了

@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

用的openwrt是
OpenWrt R23.3.3 GDQ V1[2023] Compiled by eSir / LuCI Master (git-23.082.27304-adda8b2)

@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

docker镜像内容器是有网的,我特意整了一个 http 访问的传递baidu.com容器内就会自动返回baidu的结果

@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

Quote re

用不用代理都是一样的错误。。 代理到底应该怎么配置,目前 配置到daemon提示不支持的配置

@lisaac
Copy link
Owner

lisaac commented Aug 9, 2023

你可能需要安装文档来操作:https://docs.docker.com/engine/reference/commandline/dockerd/#proxy-configuration
另外dockerd 版本23 以下只支持环境变量方式

@lisaac lisaac changed the title 无论如何都不走代理, 也不走镜像大佬咋整啊,我崩溃了啊, docker daemon 代理使用 Aug 9, 2023
@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

@lozn00
Copy link
Author

lozn00 commented Aug 9, 2023

大佬,我这个怎么升级呢,还是说不能升级呀 openwrt

@lozn00
Copy link
Author

lozn00 commented Aug 10, 2023

我就是用的使用环境变量(HTTP_PROXY、HTTPS_PROXY和NO_PROXY)。 也就是 linux shell,上面的图已经证明了, shell工作中。
高版本的配置又不生效

@FredyVia
Copy link

FredyVia commented Jun 9, 2024

这个luci-app-dockerman会生成daemon.json,在/tmp/dockerd/daemon.json,你改默认的/etc/docker/daemon.json没用,启动时会使用--config-file指定tmp目录下的那个daemon.json,看/etc/init.d/dockerd里面的启动脚本发现,process_configuration里面他会判断/etc/config/dockerd配置文件是否存在,不存在则使用默认的(/etc/docker/daemon.json),所以为了让dockerd使用我们的daemon.json,把/etc/config/dockerd删掉或者备份到另一个位置,那么启动时会使用/etc/config/daemon.json,在/etc/cofnig/daemon.json里面指定

"proxies": {
        "http-proxy": "http://example.com:8848",
        "https-proxy": "http://example.com:8848",
        "no-proxy": "127.0.0.0/8"
    },

才会生效

@FredyVia
Copy link

FredyVia commented Jun 9, 2024

建议luci-app-dockerman提供配置代理的选项

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants