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

size of image is not shown #296

Closed
mprivoro opened this issue Apr 20, 2023 · 17 comments
Closed

size of image is not shown #296

mprivoro opened this issue Apr 20, 2023 · 17 comments
Labels

Comments

@mprivoro
Copy link

image

cannot see image size for any installation

@Joxit
Copy link
Owner

Joxit commented Apr 30, 2023

Hi, thank you for using my project 😄

I need more details about your issue 🙂

@Aleksey6115
Copy link

https://ibb.co/Zh1n2FZ or https://pasteboard.co/LnXxQha0H2BZ.png
https://ibb.co/L5GT1r8 or https://pasteboard.co/gxA4JjmMnw4T.png
https://ibb.co/n37dcK3 or https://pasteboard.co/BJlXuGdMI1Ez.png

ununtu 22.04.2
docker 23.0.5
dockercompose 2.17.3
delete not working, push DELETE button doen not gives effect
push working
pull working
history not showing enything
DOCKERFILE button not showing enything, just empty window

@Joxit
Copy link
Owner

Joxit commented May 4, 2023

I checked your screenshot, please next time fufill correctly a bug report as defined here

So there are no longer an option named URL in docker-registry-ui since v2, you may use REGISTRY_URL instead.

I would need errors in your web console.

@Aleksey6115
Copy link

Access to XMLHttpRequest at 'https://10.0.0.224/v2/********integration/manifests/666' from origin 'https://dockerregistry2.domain.tld/' has been blocked by CORS policy: Request header field accept is not allowed by Access-Control-Allow-Headers in preflight response.
docker-registry-ui.js:40 GET https://10.0.0.224/v2/********integration/manifests/666 net::ERR_FAILED

10.0.0.224 is registry container
https://dockerregistry2.domain.tld is Joxit/docker-registry-ui container

With https or without, with ip or with fqdn error the same - has been blocked by CORS policy.

@Joxit
Copy link
Owner

Joxit commented May 20, 2023

Hi, your error says

has been blocked by CORS policy: Request header field accept is not allowed by Access-Control-Allow-Headers in preflight response.

The configuration for Access-Control-Allow-Headers is missing from your docker registry configuration. You usually need this configuration:

http:
  headers:
    Access-Control-Allow-Methods: ['HEAD', 'GET', 'OPTIONS', 'DELETE']
    Access-Control-Allow-Headers: ['Authorization', 'Accept', 'Cache-Control']
    Access-Control-Expose-Headers: ['Docker-Content-Digest']

@xyb
Copy link

xyb commented Jun 5, 2023

I'm experiencing a similar issue as well, and I have already configured the Access-Control-Allow-Headers. Here are some additional details:

  • Docker Registry UI version: 2.4.1
  • Registry version: 2.8.0
  • Configuration of headers:
    http:
      addr: :5000
      headers:
        Access-Control-Allow-Methods: ['HEAD', 'GET', 'OPTIONS', 'DELETE']
        Access-Control-Allow-Headers: ['Authorization', 'Accept', 'Cache-Control']
        Access-Control-Expose-Headers: ['Docker-Content-Digest']
        Access-Control-Allow-Origin: ['https://registry-ui.my']
        Access-Control-Max-Age: [1728000]
        X-Content-Type-Options: [nosniff]

@Joxit
Copy link
Owner

Joxit commented Jun 5, 2023

Hello, thank you for using my project. I need more details such as the browser console + network tab

@colindawson
Copy link

colindawson commented Jun 6, 2023

Hi, I think I'm having the same issue. let's see if I can help get you the information that you need.
Here's my registry config file.

version: 0.1
log:
  fields:
    service: registry
storage:
  delete:
    enabled: true
  cache:
    blobdescriptor: inmemory
  filesystem:
    rootdirectory: /var/lib/registry
http:
  addr: :5000
  headers:
    X-Content-Type-Options: [nosniff]
    Access-Control-Allow-Origin: ['http://linux.lan.local:8080']
    Access-Control-Allow-Methods: ['HEAD', 'GET', 'OPTIONS', 'DELETE']
    Access-Control-Allow-Headers: ['Authorization', 'Accept', 'Cache-Control']
    Access-Control-Max-Age: [1728000]
    Access-Control-Allow-Credentials: [true]
    Access-Control-Expose-Headers: ['Docker-Content-Digest']
auth:
  htpasswd:
    realm: basic-realm
    path: /etc/docker/registry/htpasswd

I'm both containers on the same linux machine using docker-compose. Here's my yml

version: '3.1'

services:
  registry-server:
    image: registry:2.8.2
    restart: always
    ports:
      - 5000:5000
    environment:
      REGISTRY_AUTH: htpasswd
      REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
      REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
    volumes:
      - ./registry/data:/var/lib/registry
      - ./registry/config.yml:/etc/docker/registry/config.yml:ro
      - ./registry/auth:/auth
    container_name: registry-server

  registry-ui:
    image: joxit/docker-registry-ui:main
    restart: always
    ports:
      - 8080:80
    environment:
      - REGISTRY_URL=http://linux.lan.local:5000
      - DELETE_IMAGES=true
      - SHOW_CONTENT_DIGEST=true
    container_name: registry-ui

The registry-ui is not on the web, or accessible from outside my private network. I'm still using authentication, as the registry itself is web published via a reverse proxy.

Here's the console errors
image

Here's the network tab
image

@Joxit
Copy link
Owner

Joxit commented Jun 6, 2023

Hi @colindawson, your issue is simple, you just need to read the FAQ and all the linked issues...:

  • Why OPTIONS (aka preflight requests) and DELETE fails with 401 status code (using Basic Auth) ?
    • This is caused by a bug in docker registry, it returns 401 status requests on preflight requests, this breaks W3C preflight-request specification. I suggest to have your UI on the same domain than your registry e.g. registry.example.com/ui/ or use NGINX_PROXY_PASS_URL or configure a nginx/apache/haproxy in front of your registry that returns 200 on each OPTIONS requests. (see #104, #204, #207, #214, #266).

If you are using NGINX_PROXY_PASS_URL solution, don't forget to set SINGLE_REGISTRY=true and read carefully the documentation

@colindawson
Copy link

@Joxit I've read through that part of the FAQ, skimmed, the linked issues, looked at the documentation, and it all means absolutely nothing to me. I'm not using NGINX_PROXY_PASS_URL. For the purposes of the registry UI, I'm running both containers on the same machine, the registry on port 5000, and the registry-ui on port 8080.

@Joxit
Copy link
Owner

Joxit commented Jun 6, 2023

Yeah, but this is exactly what I saw in your screenshot: "preflight request" and "401 status code". Both of them are in the FAQ.

The FAQ gives you three ways to fix your issue: Use the same domain OR use NGINX_PROXY_PASS_URL OR configure a nginx/apache/haproxy in front of your registry. Pick one.

Some working examples from the linked issues that uses NGINX_PROXY_PASS_URL: #204 (comment) and #204 (comment)

Or I can do it for you:

docker-compose.yaml

version: '3.1'

services:
  registry-server:
    image: registry:2.8.2
    restart: always
    ports:
      - 5000:5000
    environment:
      REGISTRY_AUTH: htpasswd
      REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
      REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
    volumes:
      - ./registry/data:/var/lib/registry
      - ./registry/config.yml:/etc/docker/registry/config.yml:ro
      - ./registry/auth:/auth
    container_name: registry-server

  registry-ui:
    image: joxit/docker-registry-ui:main
    restart: always
    ports:
      - 8080:80
    environment:
      - NGINX_PROXY_PASS_URL=http://registry-server:5000
      - DELETE_IMAGES=true
      - SHOW_CONTENT_DIGEST=true
      - SINGLE_REGISTRY=true
    container_name: registry-ui

This configuration should work for you

@colindawson
Copy link

That fixed it for me. Everything sounded far too cryptic for me. Seeing the example above, showed me what to do...

  registry-ui:
    image: joxit/docker-registry-ui:main
    restart: always
    ports:
      - 8080:80
    environment:
      - NGINX_PROXY_PASS_URL=http://registry-server:5000
#      - REGISTRY_URL=http://linux.lan.local:5000
      - DELETE_IMAGES=true
      - SHOW_CONTENT_DIGEST=true
      - SINGLE_REGISTRY=true
    container_name: registry-ui

In summary the delta change is

remove "- REGISTRY_URL=http://linux.lan.local:5000"
add - NGINX_PROXY_PASS_URL=http://registry-server:5000
and - SINGLE_REGISTRY=true

Then hey presto, it's all working as you intended.

image

Thank you. It would not surpise me if the OP had the same issue, just didn't know how to articulate the problem.

@Joxit
Copy link
Owner

Joxit commented Jun 7, 2023

Nice !
I tried to be as clear as possible in the FAQ 😕 Linking to some example would be better for you ?

@colindawson
Copy link

Linking to some example would be better for you ?

Maybe worth adding a docker-compose folder to the examples, and putting in a docker-compose like I have? That should be enough to get a simple example working. Also wondering if it's possible to combine the NGINX_PROXY_PASS_URL and REGISTRY_URL parameters, so that there's no need to switch from one to the other. Again would help to simplify the setup for people who are not familiar with the project.

@Joxit
Copy link
Owner

Joxit commented Jun 7, 2023

In fact, they already exists 😅 Your first docker-compose.yml and the new one

The use of REGISTRY_URL and NGINX_PROXY_PASS_URL is really different.
REGISTRY_URL should be use when your registry is on a different URL, but as it says in the README you need CORS configurations

NGINX_PROXY_PASS_URL as the name suggest, uses NGINX as a proxy for your registry. This avoid CORS configuration and is simpler for newbies in OPS and web. Maybe I should share this one as default configuration 🤔

@colindawson
Copy link

Ah ha. now I see why I didn't see those files, didn't think to look in that folder. Here's my logic as to why....

  1. Was looking in the examples folder for "docker-compose", didn't find it.
  2. Did see "helm" and "kubernetes", so didn't think to keep digging.

Not sure if anything can/should be changed. Just pointing out what was going on in my head.

Anyways, I love that it's working, and it's giving me much much more information that I expected. Love the project, it's awesome.

@Joxit
Copy link
Owner

Joxit commented Jun 9, 2023

Thank you for you feedback 😄 I added a recommended docker-compose in the main README with the release of 2.5.0! I think the example part need some rework anyway 😄

Thank you, I really appreciate 🥰

@Joxit Joxit added the question label Apr 5, 2024
@Joxit Joxit closed this as completed Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants