Mun*_*kin 6 proxy docker dockerfile docker-for-windows
我在代理后面,我无法构建 Docker 映像。
我试着用FROM ubuntu
,FROM centos
和FROM alpine
,但apt-get update
/ yum update
/apk update
失败。
我的主机操作系统是 Windows 10,所以我配置了我的 Docker 设置以使用我们的代理。
我还补充说
ENV http_proxy http://<PROXY>
ENV https_proxy http://<PROXY>
Run Code Online (Sandbox Code Playgroud)
到我的 Dockerfile 但没有成功。
我也尝试将我的代理设置为http://<USER>:<PASS>@<PROXY>
,但同样没有成功。
我能够拉取 Docker 镜像。当我将代理设置设置为无代理时,我无法提取图像,所以我猜我的代理 URL 是正确的。
任何想法我还能尝试什么?
编辑:
我还尝试将我们的 DNS 服务器(列在 下ipconfig /all
)添加到 Docker 设置中,但同样没有成功。
Edit2:
我刚刚意识到我忘记了Ubuntu Dockerfile 中的“ http:// ”。添加后,docker build
现在适用于 ubuntu - 但仅适用于 ubuntu。它仍然不适用于centos
and alpine
。
这是我所有的 3 个 Dockerfile:
Ubuntu:
FROM ubuntu
ENV http_proxy "http://<MY-PROXY>"
ENV https_proxy "http://<MY-PROXY>"
RUN apt-get update
Run Code Online (Sandbox Code Playgroud)
CentOS:
FROM centos
ENV http_proxy "http://<MY-PROXY>"
ENV https_proxy "http://<MY-PROXY>"
RUN yum update
Run Code Online (Sandbox Code Playgroud)
高山:
FROM alpine
ENV http_proxy "http://<MY-PROXY>"
ENV https_proxy "http://<MY-PROXY>"
RUN apk update
Run Code Online (Sandbox Code Playgroud)
错误信息:
中央操作系统:
Step 4/4 : RUN yum update
---> Running in 3deecb71823d
Loaded plugins: fastestmirror, ovl
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
[...]
Cannot find a valid baseurl for repo: base/7/x86_64
Run Code Online (Sandbox Code Playgroud)
高山:
Step 4/4 : RUN apk update
---> Running in 76c8579734cf
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.6/main: could not connect to server (check repositories file)
WARNING: Ignoring APKINDEX.84815163.tar.gz: No such file or directory
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
2 errors; 11 distinct packages available
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.6/community: could not connect to server (check repositories file)
WARNING: Ignoring APKINDEX.24d64ab1.tar.gz: No such file or directory
The command '/bin/sh -c apk update' returned a non-zero code: 2
Run Code Online (Sandbox Code Playgroud)
您是否在指令ENV http_proxy
后设置了指令RUN apt-get update
?
它们应该在使用之前设置,因为 docker 从 dockerfile 从上到下构建镜像。
归档时间: |
|
查看次数: |
8155 次 |
最近记录: |