Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apk return DNS lookup error #445

Closed
hichamuntitled opened this issue Sep 27, 2018 · 7 comments
Closed

apk return DNS lookup error #445

hichamuntitled opened this issue Sep 27, 2018 · 7 comments

Comments

@hichamuntitled
Copy link

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?

@little-dude
Copy link

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

@TangGuoHua
Copy link

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

@mgpradeepa
Copy link

mgpradeepa commented Mar 22, 2021

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 !!

@ticdenis
Copy link

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

@seanjoe
Copy link

seanjoe commented Apr 25, 2021

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

@hichamuntitled
Copy link
Author

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.

@hmeScaler
Copy link

hmeScaler commented Aug 1, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants