I got the following error inside my gitlab runner:
ERROR: failed to authorize: failed to fetch anonymous token: Get "https://auth.ipv6.docker.com/token?scope=repository%3Alibrary%2Fnode%3Apull&service=registry.docker.io": dial tcp [2600:1f18:2148:bc02:4bf0:3a98:55ae:e3d5]:443: connect: cannot assign requested address
see: https://docs.docker.com/registry/spec/auth/token/
Is there a way to change auth.ipv6.docker.com with auth.ipv4.docker.com somewhere ?
2
Answers
The response of tinco https://github.com/docker/hub-feedback/issues/2165#issuecomment-1690293630 worked for me
This seems to be related to the recent (as of 2023-08-24) changes on the Docker registry enabling IPv6 globally.
https://www.docker.com/blog/docker-hub-registry-ipv6-support-now-generally-available/
There may be something specific with the infrastructure, as several users declare using servers hosted by Hetzner.
From what I could gather from this Github issue, you can either:
Enable IPv6
Change
/etc/docker/daemon.json
, according to the Docker documentation.For example:
Or,
Force the IPv4 registry domain
Add this to
/etc/docker/daemon.json
:Don’t forget to restart the daemon.
We had the same issue on our Gitlab CI, also hosted on Hetzner. We went with the latter, pending a more robust solution.