Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DISABLE_IPV6 to ignore AAAA records when proxying requests #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

deejgregor
Copy link

@deejgregor deejgregor commented Oct 19, 2022

I was getting signal 11 crashes from nginx with
docker-registry-proxy versions 0.6.2 and 0.6.4 (test performed pulling ubuntu through docker-registry-proxy without it being in the cache):

2022/10/19 03:54:57 [alert] 74#74: worker process 76 exited on signal 11

Leading to image pull errors in Docker and Kubernetes, e.g.:

docker: error pulling image configuration: download failed after attempts=6: EOF.

With the latest code in master, I get failures like instead of signal 11, but it sometimes seems to work, however:

2022/10/19 04:00:39 [crit] 83#83: *23 connect() to [2606:4700::6812:7c19]:443 failed (99: Address not available) while connecting to upstream, client: 127.0.0.1, server: proxy_caching_, request: "GET /v2/library/ubuntu/blobs/sha256:d63f752103bb93d846e17fa9996d3e708717c51b106382fe84d8527ee47a3547 HTTP/1.1", upstream: "https://[2606:4700::6812:7c19]:443/registry-v2/docker/registry/v2/blobs/sha256/d6/d63f752103bb93d846e17fa9996d3e708717c51b106382fe84d8527ee47a3547/data?verify=1666155039-2OQ%2BkxWXW53KIWSACLv3vpuPCD8%3D", host: "registry-1.docker.io"

If I set DISABLE_IPV6=true with this change, it works just fine, no errors like shown above.

@rpardini
Copy link
Owner

Test workflow failed also against the master branch. Something possibly unrelated broke...

@deejgregor
Copy link
Author

Test workflow failed also against the master branch. Something possibly unrelated broke...

Doh! Sorry, I missed your comment. I'll take a look shortly.

@vegassor
Copy link

Hi @deejgregor ! Did you have a chance to take a look at the check?

Copy link

@deviantintegral deviantintegral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR fixes ghcr.io caching for me. I'm caching from my home internet connection, where I have IPv6 supported but have not configured Docker for this.

As well, neither lima / colima or Docker Desktop currently support IPv6. So, getting this in should help with those wanting to use this on a workstation.

@@ -102,6 +102,7 @@ ENV PROXY_REQUEST_BUFFERING="true"
- PROXY_CONNECT_READ_TIMEOUT : see [proxy_connect_read_timeout](https://github.com/chobits/ngx_http_proxy_connect_module#proxy_connect_read_timeout)
- PROXY_CONNECT_CONNECT_TIMEOUT : see [proxy_connect_connect_timeout](https://github.com/chobits/ngx_http_proxy_connect_module#proxy_connect_connect_timeout)
- PROXY_CONNECT_SEND_TIMEOUT : see [proxy_connect_send_timeout](https://github.com/chobits/ngx_http_proxy_connect_module#proxy_connect_send_timeout))
- Env `DISABLE_IPV6`: If you have problems with `nginx` attempting to connect to hosts over IPv6 but your network doesn't properly support IPv6, set this to `true` to ignore IPv6 AAAA records in DNS responses.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Env `DISABLE_IPV6`: If you have problems with `nginx` attempting to connect to hosts over IPv6 but your network doesn't properly support IPv6, set this to `true` to ignore IPv6 AAAA records in DNS responses.
- Env `DISABLE_IPV6`: If you have problems with `nginx` attempting to connect to hosts over IPv6 but your network doesn't properly support IPv6, set this to `true` to ignore IPv6 AAAA records in DNS responses. If you see errors like `failed (99: Address not available) while connecting to upstream` and images are not caching properly, try this setting.

@@ -25,7 +25,11 @@ echo "DEBUG, determined RESOLVERS from /etc/resolv.conf: '$RESOLVERS'"
conf=""
for ONE_RESOLVER in ${RESOLVERS}; do
echo "Possible resolver: $ONE_RESOLVER"
conf="resolver $ONE_RESOLVER; "
if [[ "a${DISABLE_IPV6}" == "atrue" ]]; then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, is prepending a a trick to avoid having to check if the variable is empty, or something else?

@gz243
Copy link

gz243 commented Oct 7, 2023

Hi, any chance we can get this fix released? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants