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

Provide better error information #25

Closed
massenz opened this issue Jan 15, 2018 · 4 comments

Comments

@massenz
Copy link

commented Jan 15, 2018

I am using this to connect to a plain vanilla private registry running on localhost:5000 and, while I'm sure the registry works just fine (a GET localhost:5000/v2/_catalog returns all correct values (there is no authentication, no https) and another UI works just fine, this just fails with a:

An Error occurred

and no information about what could possibly have gone wrong.

I start the UI with:

$ docker run -d -p 80:80 -e URL=http://127.0.0.1:5000 -e DELETE_IMAGES=true joxit/docker-registry-ui:static
81445a6f88c7dcdcd82e034143179707b63544f398653fbc911a69a7f33a0f00

This is a simple example to verify the registry API is reachable:

$ curl -fs http://localhost:5000/v2/_catalog | python -m json.tool
{
    "repositories": [
        "8caa8/entry",
        "server/base"
    ]
}

@Joxit Joxit self-assigned this Jan 15, 2018

@Joxit

This comment has been minimized.

Copy link
Owner

commented Jan 18, 2018

Hi,
What is your docker registry configuration ?
It may be a CORS issue, see this for a good docker registry configuration. You must add an Access-Control-Allow-Origin header in server response to indicating which origin sites are allowed.

@massenz

This comment has been minimized.

Copy link
Author

commented Jan 21, 2018

This is just a dev instance, so I'm running the registry straight from these Instructions:

$ docker run -d -p 5000:5000 --restart=always --name registry-srv registry:2

Also, as mentioned above, a straight curl gets the list of images and another Registry Web UI I'm now using (hyper/docker-registry-web) works just fine.

You must add an Access-Control-Allow-Origin header in server response

While I won't argue with your design choices, I would contend that this should be rather unnecessary in a "plain vanilla" dev deployment where one just wishes to see what's possible; especially considering that a plain 'curl' "just works."

And, by the way, thanks for confirming that a better error message would be helpful to everyone 😆

It's really too bad about this: while I have found something "that works," this one seemed to have the promise of a better, more pleasant UI - I guess we'll never know...

@Joxit

This comment has been minimized.

Copy link
Owner

commented Jan 25, 2018

CORS (or Cross-origin Resource Sharing) is a browser security and allow by default only Same Origin requests (same URI scheme, host name, and port number). This policy prevents a malicious script on one page from obtaining access to sensitive data on another web page.

If you have the UI on http://localhost/ and registry on http://localhost:5000, without the CORS header your browser will drop the request without notification. That is why joxit/docker-registry-ui can't show your private registry.

For the error message, CORS related errors raises error event on XMLHttpRequest, and as defined in specs, this don't give custom message. That why we can't have better error messages... 😞

joxit/docker-registry-ui is a standalone User Interface and hyper/docker-registry-web is a Java webapp with a middleware for the docker registry, that why there are no CORS issue.

If you don't want to add a configuration file, you can also run your docker registry with the extra option -e REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin="*".

Anyway, I will add a new proxy config with Nginx, this should fix your issue 😉

Joxit added a commit that referenced this issue Jan 25, 2018

@Joxit

This comment has been minimized.

Copy link
Owner

commented Mar 4, 2018

Fixed with bf3e3c9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.