Open AnMokoto opened 2 months ago
What about if you run docker run <your-base-image>
, can you curl inside of that container?
What about if you run
docker run <your-base-image>
, can you curl inside of that container?
@tonistiigi Thx reply. Yes, it is normal, only error when using curl to access "github". The network access to GitHub in our country is unstable, so we need to go through the company's DNS. Maybe Is it possible that the container does not through the our's DNS?
Now, only use "--driver docker-container" failure, "--driver docker" always successful.
For buildkit to not use default DNS inside the container, you need to either use host networking or the resolv.conf
inside the container needs to contain non-localhost addresses.
Sorry, i do not understand. @tonistiigi
- docker context create ctx-$ARCH-$CI_PROJECT_ID
- docker buildx create --name mybuilders --driver docker-container --buildkitd-flags '--oci-worker-net host' --use ctx-$ARCH-$CI_PROJECT_ID
- |
docker buildx build \
--load \
--builder mybuilders \
--platform linux/${ARCH} \
--build-arg FLUTTER_VERSION=$FLUTTER_VERSION \
--cache-from type=registry,ref=${TAG_NAME} \
--cache-to type=inline,mode=max \
--tag ${TAG_NAME} \
--allow network.host \
--network host \
--file Dockerfile \
.
host/system DNS
$ cat /etc/resolv.conf
search gitlab-runner.svc.cluster.local svc.cluster.local cluster.local gz.xxx.cn
nameserver 10.43.0.10
options ndots:5
container using the host/system DNS
#10 [3/5] RUN cat /etc/resolv.conf
#10 0.120 # Generated by Docker Engine.
#10 0.120 # This file can be edited; Docker Engine will not make further changes once it
#10 0.120 # has been modified.
#10 0.120
#10 0.120 nameserver 10.43.0.10
#10 0.120 search gitlab-runner.svc.cluster.local svc.cluster.local cluster.local gz.xxx.cn
#10 0.120 options ndots:5
#10 0.120
#10 0.120 # Based on host file: '/etc/resolv.conf' (legacy)
#10 0.120 # Overrides: []
#10 0.120 # Option ndots from: host
#10 DONE 0.1s
I checked the following information:
https://docs.docker.com/engine/network/tutorials/host/ https://docs.docker.com/engine/network/drivers/host/ https://docs.docker.com/reference/cli/docker/buildx/build/#allow https://docs.docker.com/reference/cli/docker/buildx/build/#network https://docs.docker.com/reference/cli/docker/buildx/create/#buildkit-daemon-network-mode
ISSUE
CODE
ENVIROMENT
GITLAB-RUNNER: 17.02
tonistiigi/binfmt:latest sha256:66e11bea77a5ea9d6f0fe79b57cd2b189b5d15b93a2bdb925be22949232e4e55
CHECK LIST
In Container:
✅ DNS
✅ ping & nslookup & dig
❎ curl
In Node:
TRY FIXING
❎ CURL -V
Install ca-certificates
Refer:https://stackoverflow.com/questions/35821245/github-server-certificate-verification-failed/35824116#35824116
STILL ERROR.
❎ Custom Parameters
STILL ERROR.
✅ RESET "--driver" DEFAULT
But, "--driver docker " not support multi-platforms.