gliderlabs / docker-alpine

Alpine Linux Docker image. Win at minimalism!
http://gliderlabs.viewdocs.io/docker-alpine
BSD 2-Clause "Simplified" License
5.71k stars 529 forks source link

Issues with wget/apk in alpine:3.13.0 and up #562

Open MikeK184 opened 2 years ago

MikeK184 commented 2 years ago

As the title suggests there seems to be an issue with apk/wget when using alpine:3.13.0 and higher. I have a simple Dockerfile:

FROM alpine:3.15.0

ENV http_proxy http://igwng.m086:3128
ENV https_proxy http://igwng.m086:3128

RUN http_proxy=http://igwng.m086:3128 apk add wget

When you build this Dockerfile docker build -f Dockerfile .

[+] Building 21.2s (5/5) FINISHED                                                                                                                  
 => [internal] load build definition from Dockerfile                                                                                          0.1s
 => => transferring dockerfile: 194B                                                                                                          0.0s
 => [internal] load .dockerignore                                                                                                             0.1s
 => => transferring context: 2B                                                                                                               0.0s
 => [internal] load metadata for docker.io/library/alpine:3.15.0                                                                             10.8s
 => CACHED [1/2] FROM docker.io/library/alpine:3.15.0@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300                 0.0s
 => ERROR [2/2] RUN http_proxy=http://igwng.m086:3128 apk add wget                                                                           10.3s
------                                                                                                                                             
 > [2/2] RUN http_proxy=http://igwng.m086:3128 apk add wget:                                                                                       
#5 0.241 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz                                                             
#5 5.246 ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.15/main: temporary error (try again later)                                                
#5 5.246 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/main: No such file or directory
#5 5.247 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
#5 10.25 ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.15/community: temporary error (try again later)
#5 10.25 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/community: No such file or directory
#5 10.25 ERROR: unable to select packages:
#5 10.25   wget (no such package):
#5 10.25     required by: world[wget]
------
executor failed running [/bin/sh -c http_proxy=http://igwng.m086:3128 apk add wget]: exit code: 1

However, downgrading to alpine:3.12.0 works:

[+] Building 12.0s (6/6) FINISHED                                                                                                                  
 => [internal] load build definition from Dockerfile                                                                                          0.1s
 => => transferring dockerfile: 194B                                                                                                          0.0s
 => [internal] load .dockerignore                                                                                                             0.1s
 => => transferring context: 2B                                                                                                               0.0s
 => [internal] load metadata for docker.io/library/alpine:3.12.0                                                                             11.8s
 => [1/2] FROM docker.io/library/alpine:3.12.0@sha256:185518070891758909c9f839cf4ca393ee977ac378609f700f60a771a2dfe321                        0.0s
 => CACHED [2/2] RUN http_proxy=http://igwng.m086:3128 apk add wget                                                                           0.0s
 => exporting to image                                                                                                                        0.0s
 => => exporting layers                                                                                                                       0.0s
 => => writing image sha256:b62d5de7aa35dfd4a4f9b87b69bdf1ff31e6e94e2083d6e18504d0731bc76d15                                                  0.0s

I've done a couple of tests regarding proxy/restarting Docker and pretty much anything else you could find on the web, nothing helped. But maybe this is a DNS Issue:

docker run -it --env http_proxy=http://igwng.m086:3128 --env https_proxy=http://igwng.m086:3128 alpine:3.12.0 sh
Unable to find image 'alpine:3.12.0' locally
3.12.0: Pulling from library/alpine
df20fa9351a1: Already exists 
Digest: sha256:185518070891758909c9f839cf4ca393ee977ac378609f700f60a771a2dfe321
Status: Downloaded newer image for alpine:3.12.0
/ # nslookup github.com
Server:         192.168.65.5
Address:        192.168.65.5:53

Non-authoritative answer:
Name:   github.com
Address: 140.82.121.4

/ # exit

docker run -it --env http_proxy=http://igwng.m086:3128 --env https_proxy=http://igwng.m086:3128 alpine:3.15.0 sh
Unable to find image 'alpine:3.15.0' locally
3.15.0: Pulling from library/alpine
59bf1c3509f3: Already exists 
Digest: sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300
Status: Downloaded newer image for alpine:3.15.0
/ # nslookup github.com
Server:         192.168.65.5
Address:        192.168.65.5:53

Non-authoritative answer:
Name:   github.com
Address: 140.82.121.4

*** Can't find github.com: No answer

/ # exit