How to pull docker image in a pure IPv6 host?
Docker Hub does NOT support IPv6!!!!!
In Dec 2020, docker hub only supports IPv4, and that's sad!
$ docker pull nginxUsing default tag: latestError response from daemon: Get https://registry-1.docker.io/v2/: dial tcp 52.4.20.24:443: connect: network is unreachable
But I need to pull images from docker hub, what should I do?
Proxy!
Yes, all we need is a HTTP proxy. Basically, I setup a HTTP proxy in another DUAL stack host (a host with both IPv4&IPv6), and ask the docker to use it.
HOW-TO
1. install proxy
I use goproxy. Download, extract, start proxy. By default, it listens on 33080.
$ ./proxy http --debug
--debug is for verbose information, drop it if everything goes well.
2. tell docker to use the proxy
$ sudo systemctl edit docker.service
and add the following to the file..
[Service]Environment="HTTP_PROXY=http://[Dualstack_IPv6]:33080"Environment="HTTPS_PROXY=https://[Dualstack_IPv6]:33080"
# reload to read the changes
$ sudo systemctl daemon-reload
# restart docker
$ sudo systemctl restart docker
# here we go!
$ docker pull nginx
PS, make sure nginx is listening on IPv6.
listen [::]:80 #you need this line!
listen 80 # this listens on IPv4.
Reference
https://github.com/docker/roadmap/issues/89
(Yes, I am dawnfantasy)
Comments
Post a Comment