https://gcore.com/learning/4-easy-steps-to-set-up-a-private-docker-registry-on-ubuntu/
El el fichero /etc/nginx/sites-available/registry.conf, asegurarse de poner la directiva client_max_body_size 0;
server { ## # Aquí va el nombre del servidor ## server_name registry.reymota.es;
location / {
##
# El puerto tiene que ser el del servicio por el que la aplicación escucha
##
proxy_pass http://127.0.0.1:30342/;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
client_max_body_size 0;
proxy_read_timeout 300s;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/registry.reymota.es/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/registry.reymota.es/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
} server { if ($host = registry.reymota.es) { return 301 https://$host$request_uri; } # managed by Certbot
server_name registry.reymota.es;
listen 80;
return 404; # managed by Certbot
}
https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
While accepted answer is a good end solution, there is a simpler way to achieve this, without using the API: just delete the tag dirs manually from registry storage and then run the garbage-collect.
First identify where your registry stores the data. By default it goes to /var/lib/registry dir inside the container, but its probably binded to your host one way or the other. I am using docker-compose with data volume so in my case its located at: /var/lib/docker/volumes/registry_data/_data/registry.
You'll find dirs named as your project tags in there, relative to above path: v2/repositories/<repo_name>/_manifests/tags
Just delete the dirs which tag you dont want anymore. For example:
rm -rf /var/lib/docker/volumes/registry_data/_data/registry/v2/repositories/I5/_manifests/tags/T12
Once you are done with that, run the garbage-collect:
docker exec <registry_container_name> registry garbage-collect /etc/docker/registry/config.yml --delete-untagged
Your registry config file may be in some other path, but this is the default. Read more about the garbage collector from docs, but the gist is: the registry binary inside the container includes a garbage-collect command, but you have to run it yourself. Of course you can always let the crontab run it for you.