7

为什么 wsl2 里用 Go 语言调 Command 模块执行 docker 命令没走代理?

 1 year ago
source link: https://www.v2ex.com/t/913280
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  程序员

为什么 wsl2 里用 Go 语言调 Command 模块执行 docker 命令没走代理?

  Albertcord · 6 小时 13 分钟前 · 489 次点击

之前在 github 上提了个issue,但发现没人回答,来 v 站求助下大佬 我的问题其实就是发现,我自己在 wsl2 里执行以下命令是可以访问到的:

curl -s -S -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer

但是我在用cog,这个库的时候发现其内部构建 Docker 镜像时获取不到上面这个 raw.githubxx ,这个链接,一直报 443 ,不过我刚刚又看了 issue ,发现怎么是报 Could not resolve host: raw.githubusercontent.com 了,我有段时间没去看了,可能我已经解决代理问题了?
继续说回问题,然后我自己写了个测试 DockerFile ,发现我 wsl2 里的 Docker 构建是会走代理的,所以很疑惑问题在哪里?有 Go 大佬帮帮忙吗,也在学 Go ,但进度有些慢,本身是前端,感觉缺少了什么上下文

FROM ubuntu
RUN apt update
RUN apt install -y git
RUN apt install -y curl
RUN cd ~
# RUN git clone https://github.com/momo-lab/pyenv-install
RUN echo $(curl -s -S -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer) > ~/test.text

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK