Unable to delete docker image and view history
EverettSy opened this issue · 2 comments
EverettSy commented
config.yml
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://47.97.156.67:8280']
Access-Control-Allow-Methods: ['HEAD', 'GET', 'OPTIONS', 'DELETE']
Access-Control-Allow-Headers: ['Authorization', 'Accept']
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/auth/htpasswd
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3
docker-compose.yaml
# docker-compose.yaml
version: '3'
services:
registry:
image: registry:latest
restart: always
ports:
- 5000:5000
container_name: registry2
environment:
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
REGISTRY_STORAGE_DELETE_ENABLED: 'true'
volumes:
- /etc/docker/registry/data:/var/lib/registry
- /etc/docker/registry/auth:/auth
- /etc/docker/registry/config.yml:/etc/docker/registry/config.yml
networks:
- registry-net
ui:
image: joxit/docker-registry-ui:latest
restart: always
container_name: registry-ui
environment:
- REGISTRY_TITLE=Private Docker Registry
- REGISTRY_URL=http://47.97.156.67:5000
- DELETE_IMAGES=true
- SINGLE_REGISTRY=false
ports:
- '8280:80'
depends_on:
- registry
networks:
- registry-net
networks:
registry-net:
Joxit commented
Hi there,
Thank you for your issue and using my project. Checkout the FAQ
- Why DELETE fails with 401 status code (using Basic Auth) ?
- This is caused by a bug in docker registry, I suggest to have your UI on the same domain than your registry e.g. registry.example.com/ui/. (see #104).
TLDR;
This is a docker registry miss-configuration of OPTIONS requests, the registry server MUST return 200 status codes on OPTIONS, but did not.
Solution 1: Use the UI as proxy, you should not have CORS errors... (use NGINX_PROXY_PASS_URL
)
Solution 2: Override OPTIONS responses on the proxy where your docker registry is hosted. You will need to return 200 status code with all correct headers (those of your docker registry)