NginxProxyManager / nginx-proxy-manager

Docker container for managing Nginx proxy hosts with a simple, powerful interface
https://nginxproxymanager.com
MIT License
23.38k stars 2.71k forks source link

Using VPS and NPM to Accelerate Docker Images #3903

Open 1945251yyq opened 4 months ago

1945251yyq commented 4 months ago

Recently, I set up Docker image acceleration, but I seem to be encountering some issues.

4

Running docker pull domain/mysql results in the following error, but running docker pull domain/library/mysql works fine.

2

Similar issues occur with images like ubuntu, alpine, and python. However, running docker pull domain/linuxserver/emby works fine.

I suspect the issue arises because typical pull commands use the format repository/image, and for mysql, which has only the image name, the pull command fails as it treats the domain as the repository.

Below are some configurations I have in the Advanced section. These are configurations I pieced together that are able to run. I am not particularly knowledgeable in this area and hope to seek help here to achieve the ability to pull images using docker pull domain/mysql and similar commands.Thank you very much.

location /v2/ {
    proxy_pass https://registry-1.docker.io;
    proxy_set_header Host registry-1.docker.io;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_hide_header Docker-Distribution-Api-Version;
    add_header Docker-Distribution-Api-Version registry/2.0 always;
    proxy_set_header Authorization $http_authorization;
    proxy_pass_header Authorization;
    proxy_buffering off;
    proxy_intercept_errors on;
    recursive_error_pages on;
    error_page 301 302 307 = @handle_redirect;
}

location /token {
    proxy_pass https://auth.docker.io;
    proxy_set_header Host auth.docker.io;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

location @handle_redirect {
    resolver 1.1.1.1;
    set $saved_redirect_location '$upstream_http_location';
    proxy_pass $saved_redirect_location;
}
endless1651 commented 4 months ago

Your image still leaked your domain name. I suggest changing it