docker buildx build failed to push image because dns resolve failed

47 Views Asked by At

I want to push multi-structure image to a private harbor registry like below.

docker buildx build --add-host=local-habor.com:10.11.140.68 \
    --builder mybuilder -t local-habor.com/test/test1:v1 \
    --platform linux/amd64,linux/arm64 -f Dockerfile-multi2 \
    --push .

I have local-habor.com --> 10.11.140.68 configured in /etc/hosts, but it seems it is not recognized in Docker, with or without --add-host=local-habor.com:10.11.140.68.

The error is:

ERROR: failed to solve: failed to push local-habor.com/test/test1:v1: failed to do request: Head "https://local-habor.com/v2/test/test1/blobs/sha256:e16b9c9f3907115a8c25e2f4be9dc3adf3cb1a2f657594b50c065fc99839bed5": dial tcp: lookup local-habor.com on 192.168.200.2:53: no such host

env: ubuntu : Ubuntu 22.04.4 LTS Version: 25.0.3 API version: 1.44 (minimum version 1.24) Go version: go1.21.6

I tried --add-host=local-habor.com:10.11.140.68 to force host resolve, but it seems not working.

I expect there is a way to configure DNS resolve in image pushing execution of during below command.

0

There are 0 best solutions below