mkuchin / docker-registry-web

Web UI for private docker registry v2
https://hub.docker.com/r/hyper/docker-registry-web/
GNU General Public License v2.0
534 stars 135 forks source link

nginx before docker registry ui #16

Closed bchanan03 closed 8 years ago

bchanan03 commented 9 years ago

Hi, I tried placing nginx proxy pass to to the docker registry ui adding a new sub-folder 'registry' the page is loaded but the resources .css .js failed to load.

Here is the nginx configuration: location ~ ^/registry/._$ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_set_header Connection "Keep-Alive"; proxy_set_header Proxy-Connection "Keep-Alive"; proxy_http_version 1.1; proxypass http://secure-registry-web.saas.lab:8080; rewrite ^/registry/(.) /$1 break; }

bchanan03 commented 9 years ago

when trying curl http://myweb.com/registry/ it should have proxy pass to container running the docker registry web but it failed to load .css .js files

s19n commented 8 years ago

+1

joshrivers commented 8 years ago

This worked for me:

location /registry {
    rewrite /registry/(.*) /$1  break;
    rewrite /registry /  break;
    proxy_pass                          http://registry-web;
}
location /assets {
    proxy_pass                          http://registry-web;
}

I would like it if the assets directory was added as a relative path. It looks like grails is opinionated about turning relative paths into absolute paths when using the asset pipeline. There is probably a way to override this, or to pass in a base path using an environment variable, but I couldn't find it in my first 30 minutes of looking.

Edit: I spoke too soon. It fixed the stylesheets, but all the links were still broken. Sad.

mkuchin commented 8 years ago

I'd added environment variable CONTEXT_PATH to access registry-web with prefix. Simply run registry-web with -e CONTEXT_PATH=/app and registry will be available on url http://hostname/app/

joshrivers commented 8 years ago

Just tested the new image from docker hub. Works perfectly with nginx.conf

location /registry {
    proxy_pass                          http://registry-web;
}

and docker run with:

-e CONTEXT_PATH=/registry

Thank you!!

mkuchin commented 8 years ago

Great!