docker-alpine icon indicating copy to clipboard operation
docker-alpine copied to clipboard

apk return DNS lookup error

Open hichamuntitled opened this issue 8 years ago • 7 comments

I am using a corporate proxy, without authentication. When I try the build an image based on alpine, It gives me the bellow error when I try to install a package.

fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.8/main: DNS lookup error
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.8/community: DNS lookup error

I build using the command docker build --build-arg http_proxy=http://proxy:8080/ -t ImName .

I already checked #171 #191 #207 but didn't help.

Any solution?

hichamuntitled avatar Sep 27 '18 14:09 hichamuntitled

The proxy URL must be escaped, as per @crts-xxx's comment. That fixed the problem for me.

little-dude avatar Dec 07 '18 13:12 little-dude

Hi hit the same issue, I am trying to build a image from docker file

here is the content of docker build file : curl.df

FROM gliderlabs/alpine:latest LABEL source=dockerinaction LABEL category=utility RUN apk --update add curl ENTRYPOINT ["curl"] CMD ["--help"]

when I try to run the build command ~ docker build -t dockerinaction/curl -f curl.df . [+] Building 3.7s (6/6) FINISHED => [internal] load build definition from curl.df 0.0s => => transferring dockerfile: 229B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/gliderlabs/alpine:latest 2.7s => [auth] gliderlabs/alpine:pull token for registry-1.docker.io 0.0s => CACHED [1/2] FROM docker.io/gliderlabs/alpine:latest@sha256:23b993692b943f0799b3f36042d8a1331557103eb4ac2c0b8ab36cab9f399f8b 0.0s => ERROR [2/2] RUN apk --update add curl 0.9s

[2/2] RUN apk --update add curl: #6 0.251 fetch http://alpine.gliderlabs.com/alpine/v3.9/main/x86_64/APKINDEX.tar.gz #6 0.853 fetch http://alpine.gliderlabs.com/alpine/v3.9/community/x86_64/APKINDEX.tar.gz #6 0.853 ERROR: http://alpine.gliderlabs.com/alpine/v3.9/main: DNS lookup error #6 0.853 WARNING: Ignoring APKINDEX.4b0f3aca.tar.gz: No such file or directory #6 0.859 ERROR: http://alpine.gliderlabs.com/alpine/v3.9/community: DNS lookup error #6 0.859 WARNING: Ignoring APKINDEX.e20d04a5.tar.gz: No such file or directory #6 0.859 ERROR: unsatisfiable constraints: #6 0.860 curl (missing): #6 0.860 required by: world[curl]


executor failed running [/bin/sh -c apk --update add curl]: exit code: 1 ~

Any suggestions?

Thanks very much

TangGuoHua avatar Feb 23 '21 04:02 TangGuoHua

I still face the issue with alpine:3.9 behind a proxy.

echo "https://local_official_repo/alpine/v3.9/main" > /etc/apk/repositories && \ echo "https://local_official_repo/alpine/v3.9/community" >> /etc/apk/repositories && \ apk add --no-cache procps

I end up in DNS lookup error which fails with exit code: 1

As suggested in other tickets with respect to http_proxy and HTTP_PROXY_AUTH did not solve the problem.

Any suggestions or solutions !!

mgpradeepa avatar Mar 22 '21 01:03 mgpradeepa

Try this temporarily.

dinghy up
eval $(dinghy env)
dinghy ssh

sudo su

dinghy_dns_ip=$(ip addr | grep "192.168" | awk '{print $2}' | cut -d/ -f1)

echo "{\"dns\": [\"$dinghy_dns_ip\",\"8.8.8.8\",\"1.1.1.1\"]}" > /etc/docker/daemon.json

exit && exit

dinghy restart

ticdenis avatar Apr 12 '21 08:04 ticdenis

I am using a corporate proxy, without authentication. When I try the build an image based on alpine, It gives me the bellow error when I try to install a package.

fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.8/main: DNS lookup error
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.8/community: DNS lookup error

I build using the command docker build --build-arg http_proxy=http://proxy:8080/ -t ImName .

I already checked #171 #191 #207 but didn't help.

Any solution?

use image alpine:3.12, not use latest

seanjoe avatar Apr 25 '21 10:04 seanjoe

Hello, Actually, I managed to solve this using docker build --network=host -t myName . So, when adding --network=host we will use the host newtork which is already using the proxy. I'm closing this issue.

hichamuntitled avatar Apr 28 '21 13:04 hichamuntitled

I am using a corporate proxy, without authentication. When I try the build an image based on alpine, It gives me the bellow error when I try to install a package.

fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.8/main: DNS lookup error
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.8/community: DNS lookup error

I build using the command docker build --build-arg http_proxy=http://proxy:8080/ -t ImName .

I already checked #171 #191 #207 but didn't help.

Any solution?

This one : docker-compose build --build-arg http_proxy=http://proxy:8080 fix my issue

thanks

hmeScaler avatar Aug 01 '23 12:08 hmeScaler