NamrataB
NamrataB

Reputation: 325

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

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?

Upvotes: 4

Views: 3045

Answers (1)

NamrataB
NamrataB

Reputation: 325

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

Upvotes: 4

Related Questions