Open alazalazalaz opened 1 day ago
I did the following step to recurrent the error:
step1、vi docker-compose.yaml
docker-compose.yaml
version: '2.1' services: buildkitd: image: moby/buildkit:v0.16.0 container_name: buildkitd privileged: true restart: always command: ["--addr", "tcp://0.0.0.0:1234"]
step2、run the container docker-compose -f docker-compose.yaml up -d buildkitd step3、entry the container docker exec -it 3a76a7e82807 /bin/sh step4、test the container network
docker-compose -f docker-compose.yaml up -d buildkitd
docker exec -it 3a76a7e82807 /bin/sh
/ # nslookup www.google.com Server: 127.0.0.11 Address: 127.0.0.11:53 Non-authoritative answer: Name: www.google.com Address: 172.217.163.36 Non-authoritative answer: Name: www.google.com Address: 2404:6800:4012:4::2004
the network is OK.
step5、create a Dockerfile, vi Dockerfile (still in the container)
Dockerfile
FROM alpine/curl RUN nslookup www.google.com
step6、build the Dockerfile (still in the container) / # buildctl --addr=tcp://0.0.0.0:1234 build --frontend=dockerfile.v0 --local context=. --local dockerfile=. --progress=plain step7、 encounter the ERROR!
/ # buildctl --addr=tcp://0.0.0.0:1234 build --frontend=dockerfile.v0 --local context=. --local dockerfile=. --progress=plain
#4 [1/2] FROM docker.io/alpine/curl:latest@sha256:a9599b0ecdab1fb3c798985836248c51ba27577218e93c99bcc1ec61969acaf8 #4 extracting sha256:1010f67b3369ce6414bb7f1ebaea67db6912f2d4045960ee5f5386e56196de8a 0.0s done #4 DONE 7.6s #5 [2/2] RUN nslookup www.google.com #5 10.31 nslookup: can't connect to remote host: Address not available #5 ERROR: process "/bin/sh -c nslookup www.google.com" did not complete successfully: exit code: 1 ------ > [2/2] RUN nslookup www.google.com: 10.31 nslookup: can't connect to remote host: Address not available ------ Dockerfile:3 -------------------- 1 | FROM alpine/curl 2 | 3 | >>> RUN nslookup www.google.com 4 | -------------------- error: failed to solve: process "/bin/sh -c nslookup www.google.com" did not complete successfully: exit code: 1
machine info: Ubuntu 18.04.6 x86_64
cat /etc/resolv.conf on the Ubuntu machine:
cat /etc/resolv.conf
nameserver 172.20.100.25 nameserver 172.20.100.27
the Ubuntu machine's network is perfectly fine.
cat /etc/resolv.conf in the container:
/ # cat /etc/resolv.conf nameserver 127.0.0.11 options ndots:0
other steps:
RUN nslookup www.google.com
curl -vvvv -s https://www.google.com
> [2/4] RUN curl -vvvv -s https://www.google.com: 0.223 * Could not resolve host: www.google.com 0.223 * shutting down connection #0
so, why the build command failed? Did i missed some config in the step 1?
update. I added network_mode:bridge in step1, partial RUN command works fun now, such as nslookup wget apt. The curl command still failed, error : curl: (6) Could not resolve host: www.google.com
network_mode:bridge
nslookup
wget
apt
curl
curl: (6) Could not resolve host: www.google.com
I did the following step to recurrent the error:
step1、vi
docker-compose.yaml
step2、run the container
docker-compose -f docker-compose.yaml up -d buildkitd
step3、entry the containerdocker exec -it 3a76a7e82807 /bin/sh
step4、test the container networkthe network is OK.
step5、create a Dockerfile, vi
Dockerfile
(still in the container)step6、build the Dockerfile (still in the container)
/ # buildctl --addr=tcp://0.0.0.0:1234 build --frontend=dockerfile.v0 --local context=. --local dockerfile=. --progress=plain
step7、 encounter the ERROR!machine info: Ubuntu 18.04.6 x86_64
cat /etc/resolv.conf
on the Ubuntu machine:the Ubuntu machine's network is perfectly fine.
cat /etc/resolv.conf
in the container:other steps:
RUN nslookup www.google.com
tocurl -vvvv -s https://www.google.com
,it produce a similar error :so, why the build command failed? Did i missed some config in the step 1?