Joxit / docker-registry-ui

The simplest and most complete UI for your private registry
https://joxit.dev/docker-registry-ui/
GNU Affero General Public License v3.0
2.5k stars 321 forks source link

Not able to delete any image #301

Open Cotagge opened 1 year ago

Cotagge commented 1 year ago

Hi, I use this docker registry UI and I have an issue...

Bug description

images can't be removed, even if I have all otions allowed in config and docker-compose

A clear and concise description of what the bug is.

How to Reproduce

I'm runnig registry in docker-compose and registry-ui in another docker-compose. connection is ok, I see all the repo. After click on trash button, it says it has be deleted by cmd " registry garbage-collect config.yml, so i do that, it says "XY blob is eligable to delete" , but nothing happens and no space was freed. (I deleted 5 images with 350Mb each)

from docker registry log: registry-registry-1 | 192.168.48.1 - - [03/May/2023:11:26:43 +0000] "DELETE /v2/heappe_approval_system-api/manifests/sha256:499f4bc59418244911c42a6a232cf87574802f8dde4a8f02732aaffeee99b390 HTTP/1.1" 202 0 "http://registry.xy.tech/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"

also strange is, that UI runs only in incognito tab in chrome, even after clear cache is not working in normal tab.

For UI bug, steps to reproduce the behavior:

  1. Go to 'image'
  2. Click on '.trash button'
  3. no error

My docker-compose file

version: '3'
services:
  registry-ui:
    image: joxit/docker-registry-ui:latest
    container_name: registry-ui-3
    ports:
      - 80:80
    environment:
      - NGINX_PROXY_PASS_URL=https://registry.xy.tech:5000
      - DELETE_IMAGES=true
      - REGISTRY_AUTH=basic
      - REGISTRY_ALLOW_DELETE=true

My private docker registry configuration

version: '2'
services:
  registry:
    image: registry:2
    ports:
      - "5000:5000"
      - "5001:5001"
    volumes:
      - /etc/docker/registry/config.yml:/etc/docker/registry/config.yml
      - /etc/certs:/etc/certs
      - /var/lib/registry:/var/lib/registry
      - /etc/docker/registry/auth:/etc/registry
    restart: always
    environment:
      - REGISTRY_STORAGE_DELETE_ENABLED=true

config.yml

version: 0.1
log:
  fields:
    service: registry
storage:
  cache:
    blobdescriptor: inmemory
  filesystem:
    rootdirectory: /var/lib/registry
  delete:
    enabled: true
http:
  addr: :5000
  headers:
    X-Content-Type-Options: [nosniff]
    Access-Control-Allow-Origin: ['https://registry.xy.tech:80']
    Access-Control-Allow-Credentials: [true]
    Access-Control-Allow-Headers: ['Authorization', 'Accept', 'Cache-Control']
    Access-Control-Allow-Methods: ['HEAD', 'GET', 'OPTIONS', 'DELETE']
    Access-Control-Expose-Headers: ['Docker-Content-Digest']

  tls:
    certificate: /etc/certs/server.crt
    key: /etc/certs/server.key
  debug:
    addr: 0.0.0.0:5001
    prometheus:
      enabled: true
      path: /metrics
auth:
  htpasswd:
    realm: basic-realm
    path: /etc/registry
health:
  storagedriver:
    enabled: true
    interval: 10s
    threshold: 3

Expected behavior

df -h will show some more free space in overlay 349G 288G 62G 83% /var/lib/docker/overlay2/03ad939bb1635f01c93d4463c923357c67386233c56bae202e8298d5e2658d

Screenshots

image

it allways says, that I have to set Access-Control-Allow-Origin: ['https://registry.xy:80'] but it is already

image

System information

Additional context

Add any other context about the problem here.

Joxit commented 1 year ago

Hi, thank you for using my project and submitting issues :smile:

First of all you I see you are using NGINX_PROXY_PASS_URL , this is working only when SINGLE_REGISTRY=true, so you have to had this option too. It's working on private tabs because when SINGLE_REGISTRY is not present, I'm using your local storage to configure your registry server endpoint.

Now if the tag you deleted is no longer present in the UI after clicking on the trash button, that means everything goes right with the UI project.

The registry server garbage collector is a bit complicated, you can check their documentation. TLDR: Deleting a 350MB image does not mean deleted 350MB on your disk. Since images are made of layers, the base image may be used by other images in your registry, so you will not free all the 350MB. You may check the issue #289 I gave some explanations too :smile: (And I may add this issue in my FAQ :thinking:)

You may also add the option --delete-untagged to your garbage-collect

Did I miss something in your issue ? There were many subjects :sweat_smile: