# install registry nel file docker-compose.yml che può essere usato in portainer vanno mofificati alcuni parametri - porta del registry e della sua UI (utilizzati qui 5557 e 5558) - NGINX_PROXY_PASS_URL=http://192.168.1.4:5557 - REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin: '[http://images-ui.patachina.casacam.net]' e i volumi - /home/nvme/dockerdata/registry:/var/lib/registry - /home/nvme/dockerdata/registry/config:/etc/docker/registry nel volume /home/nvme/dockerdata/registry/config copiare il file 'config.yml' impostare Nginx per puntare a server registry ## come si usa avere una immagine caricata e fare il pull per esempio di ubuntu con sudo docker pull ubuntu fare il tag sul server locale sudo docker tag ubuntu images.patachina.casacam.net/ubuntu fare il push sul server locale sudo docker tag ubuntu images.patachina.casacam.net/ubuntu ora si può scaricare l'immagine unubtu dal server locale anche quando si ha cancellato quella locale con sudo docker pull images.patachina.casacam.net/ubuntu se non si mette la versione lui usa l'ultima in questo esempio è ubuntu:latest inserire la versione se si vuole utilizzare solo quella ## delete-docker-registry-image ### Come Installare curl https://forgit.patachina.casacam.net/Fabio/registry/raw/branch/main/delete_docker_registry_image | sudo tee /usr/local/bin/delete_docker_registry_image >/dev/null sudo chmod a+x /usr/local/bin/delete_docker_registry_image curl https://forgit.patachina.casacam.net/Fabio/registry/raw/branch/main/del_images.sh | sudo tee /usr/local/bin/del_images.sh >/dev/null sudo chmod a+x /usr/local/bin/del_images.sh andare a modificare del_images.sh sudo nano /usr/local/bin/del_images.sh inserendo il nome del docker del server registry per fermare e far ripartire il docker e la sua folder locale registry-server REGISTRY_DATA_DIR=/home/nvme/dockerdata/registry/docker/registry/v2 per cancellare una immagine o un tag di una immagine del_images.sh :tag esempi del_images.sh ubuntu del_images.sh ubuntu:latest ## Install curl https://raw.githubusercontent.com/burnettk/delete-docker-registry-image/master/delete_docker_registry_image.py | sudo tee /usr/local/bin/delete_docker_registry_image >/dev/null sudo chmod a+x /usr/local/bin/delete_docker_registry_image ## Run Set up your data directory via an environment variable: export REGISTRY_DATA_DIR=/opt/registry_data/docker/registry/v2 You can also just edit the script where this variable is set to make it work for your setup. Almost delete a repo: delete_docker_registry_image --image testrepo/awesomeimage --dry-run Actually delete a repo (remember to shut down your registry first): delete_docker_registry_image --image testrepo/awesomeimage Delete one tag from a repo: delete_docker_registry_image --image testrepo/awesomeimage:supertag ## clean_old_versions.py This complimentary script is made to remove tags in repository based on regexp pattern. Usage: ./clean_old_versions.py --image reg_exp_of_repository_to_find --include reg_exp_of_tag_to_find -l history_to_maintain --registry-url location_of_docker_registry -o tag_ordering -b only_tags_before_date -a only_tags_after_date Example: Search for all images whose name start with 'repo/sitor' and delete all tags whose name start with '0.1.' keeping the last 2 tags and of the remaining tags deletes only those having an image creation time between January 1, 2016 12 a.m. and June 25, 2016 12 p.m. (both datetimes are exclusive). ./clean_old_versions.py --image '^repo/sitor*' --include '^0.1.*' -l 2 -b 2016-06-25T12:00:00 -a 2016-01-01T00:00:00 --registry-url http://localhost:5000 Add `--dry-run` as argument for a test run without actual removal of tags.