# Registry ## Description This docker compose run registry on docker ## Certificats Copy crt and key files on `/home/docker/certs/` ## Run ```bash docker compose up -d ``` ## Set password ```bash cd /home/docker/registry/auth htpasswd -Bc registry.password gilles ``` ## Tests ### Tag and push ```bash docker pull ubuntu docker tag ubuntu registry-docker.gmolab.net:5000/ubuntu docker login registry-docker.gmolab.net:5000 docker push registry-docker.gmolab.net:5000/ubuntu ``` ### Delete ```bash manifest=$(curl -u "gilles:pa55w0rd" -sSL -I -H "Accept: application/vnd.docker.distribution.manifest.v2+json" https://registry-docker.gmolab.net:5000/v2/ubuntu/manifests/latest | awk '$1 == "docker-content-digest:" { print $2 }'| tr -d $'\r') curl -v -u "[username]:[pw]" -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X HEAD https://[registry-ip]/v2/[image-name]/manifests/[image-version or tag number] curl -v -u "gilles:" -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X HEAD https://registry-docker.gmolab.net:5000/v2/ubuntu/manifests/latest | egrep etag docker exec -it registry bin/registry garbage-collect /etc/docker/registry/config.yml ``` ## Set registry in Portainer * on portainer goto on **Registries** menu and click on **+ Add registry** * click on **Custom registry** * type a registry name in field **Name** * type the registry's ip address and port (xxx.xxx.xxx.xxx:5000) in field **Registry URL** * active **Authentication** and fill the **Username** and **Password** with username/password (cf Set password) * click on **Add registry** ## Sources https://distribution.github.io/distribution/about/deploying/ https://medium.com/@cnadeau_/private-docker-registry-part-4-lets-secure-the-registry-250c3cef237 https://betterprogramming.pub/cleanup-your-docker-registry-ef0527673e3a https://teplyheng.medium.com/how-to-completely-remove-docker-images-from-a-docker-registry-v2-76d8a26847ff ## Changelog ### v1.0 - 2024-11-15 #### Added - initial version by [GMo](mailto:gilles.mouchet@gmail.com)