'Proxy Docker Hub with HAproxy

I'm running Sonatype Nexus as Proxy registry for Quay.io and docker.io. I'm pulling the images with a custom domain proxy-hub.example.com and proxy-quay.example.com. When Nexus is down obviously I can't download any images, so I thought I can use HAproxy to set the original URL.

backend registry_quay
balance roundrobin
server-template Nexus_nexus 1 Nexus_nexus:8085 check resolvers docker resolve-prefer ipv4 init-addr libc,none
server quay quay.io:443 check backup ssl verify none

This backend works fine as when nexus is down the backup takes over. With the same settings docker.io fails with error 503 when I turn off Nexus.

backend registry_hub
balance roundrobin
server-template Nexus_nexus 1 Nexus_nexus:8083 check resolvers docker resolve-prefer ipv4 init-addr libc,none
server hub registry-1.docker.io:443 check backup ssl verify none

I'm quite sure that something needs to be rewritten in the requests but I don't know what.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source