Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using docker buildx failed to push image to resgistry: no such host

Tags:

docker

I have added my registry vm hostname to /etc/hosts and docker pull <registry_name>/<imagename> works. However when I try to use docker buildx build .. --push command to push to the same registry, it throws error:

 => ERROR exporting to image                                                                                                             2.3s
 => => exporting layers                                                                                                                  1.9s
 => => exporting manifest sha256:...                                        0.1s
 => => exporting config sha256:...                                          0.0s
 => => exporting manifest sha256: ...                                       0.0s
 => => exporting config sha256:                                             0.1s
 => => exporting manifest list sha256:                                      0.0s
 => => pushing layers                                                                                                                    0.1s
------
 > exporting to image:
------
failed to solve: rpc error: code = Unknown desc = failed to do request: Head https://<registry_name>/v2/...: dial tcp: lookup <registry_name> : no such host

Does docker buildx does not look /etc/hosts?

like image 924
NamrataB Avatar asked Oct 31 '25 04:10

NamrataB


1 Answers

It can be achieved by setting --driver-opt to use host network.

like image 167
NamrataB Avatar answered Nov 03 '25 01:11

NamrataB



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!