alpine:edge ignores http_proxy (alpine:3.12.0 works fine)
apk add fails behind an HTTP proxy on alpine:edge. The exact same script works fine on alpine:3.12.0.
Here is a simple .gitlab-ci.yml
for convenience of testing:
# image: alpine:3.12.0
image: alpine:edge
test:
script:
- apk add openssh-client
Here is how it works on Alpine 3.12.0. This is with the http_proxy
environment variable set via https://gitlab.alpinelinux.org/dHannasch/alpine-edge-apk-add-failing-behind-proxy/-/settings/ci_cd . No other environment variables are set.
1 Running with gitlab-runner 12.1.0
3 Using Docker executor with image alpine:3.12.0 ...
4 Pulling docker image alpine:3.12.0 ...
5 Using docker image sha256:a24bb4013296f61e89ba57005a7b3e52274d8edd3ae2077d04395f806b63d83e for alpine:3.12.0 ...
19
$ apk add openssh-client
20 fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
21 fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
22 (1/5) Installing openssh-keygen (8.3_p1-r0)
23 (2/5) Installing ncurses-terminfo-base (6.2_p20200523-r0)
24 (3/5) Installing ncurses-libs (6.2_p20200523-r0)
25 (4/5) Installing libedit (20191231.3.1-r0)
26 (5/5) Installing openssh-client (8.3_p1-r0)
27 Executing busybox-1.31.1-r16.trigger
28 OK: 10 MiB in 19 packages
33 Job succeeded
Here is what happens on alpine:edge
. Again, this is with http_proxy
set.
1 Running with gitlab-runner 12.1.0 (de7731dd)
3 Using Docker executor with image alpine:edge ...
4 Pulling docker image alpine:edge ...
5 Using docker image sha256:3c791e92a856b26e22413b05ecd62316e21452f8867fcb35fad93f52ee6963fd for alpine:edge ...
19
$ apk add openssh-client
20 fetch https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
21 ERROR: https://dl-cdn.alpinelinux.org/alpine/edge/main: network error (check Internet connection and firewall)
22 WARNING: Ignoring APKINDEX.e37b76c2.tar.gz: No such file or directory
23 fetch https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
24 ERROR: https://dl-cdn.alpinelinux.org/alpine/edge/community: network error (check Internet connection and firewall)
25 WARNING: Ignoring APKINDEX.d022dfc8.tar.gz: No such file or directory
26 ERROR: unsatisfiable constraints:
27 openssh-client (missing):
28 required by: world[openssh-client]
32 ERROR: Job failed: exit code 1
Note that if you do not set http_proxy
on alpine:3.12.0
, then you get the same error message as on alpine:edge
.
22 fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
23 ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.12/main: network error (check Internet connection and firewall)
24 WARNING: Ignoring APKINDEX.2c4ac24e.tar.gz: No such file or directory
Thus, as a first hypothesis, it seems likely that alpine:edge
is simply ignoring http_proxy
.
alpine:edge
similarly appears to ignore https_proxy
, HTTP_PROXY
, and HTTPS_PROXY
.
That obviously makes reproducing the issue a little tricky, since you can't reproduce it without being behind a proxy.
I'm not sure whether to report this here or at https://github.com/alpinelinux/docker-alpine, but https://wiki.alpinelinux.org/wiki/Alpine_Linux:Contribute directed me here.