I'm behind a proxy and I'm not able to build a Docker image.
I tried with FROM ubuntu
, FROM centos
and FROM alpine
, but apt-get update
/ yum update
/ apk update
failed.
My host OS is Windows 10, so I configured my Docker settings to use our proxy.
And I also added
ENV http_proxy http://<PROXY>
ENV https_proxy http://<PROXY>
to my Dockerfile but no success.
I also tried to set my proxy to http://<USER>:<PASS>@<PROXY>
, but again no success.
I am able to pull Docker images. When I set my proxy settings to no proxy, I'm not able to pull images, so I guess my proxy URL is correct.
Any ideas what else I can try?
Edit:
I also tried to add our DNS server (which is listed under ipconfig /all
) into the Docker settings, but again no success.
Edit2:
I just realized I forget the "http://" within my Ubuntu Dockerfile. After adding this, docker build
now works fine for ubuntu - but only for ubuntu. It still doesn't work for centos
and alpine
.
Here are all my 3 Dockerfiles:
Ubuntu:
FROM ubuntu
ENV http_proxy "http://<MY-PROXY>"
ENV https_proxy "http://<MY-PROXY>"
RUN apt-get update
CentOS:
FROM centos
ENV http_proxy "http://<MY-PROXY>"
ENV https_proxy "http://<MY-PROXY>"
RUN yum update
Alpine:
FROM alpine
ENV http_proxy "http://<MY-PROXY>"
ENV https_proxy "http://<MY-PROXY>"
RUN apk update
Error messages:
CentOS:
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
Alpine:
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