Docker Community Forums

Share and learn in the Docker community.

Implementation of Portus for docker registry


(Jhdulla) #1

Hi guys anyone have knowledge on how to use portus for docker private registry. I am following some instructions but unable to run the portus. If you have guide, please assist me with my problem. Thank you


(Eldeberde) #2

Hi, im using this instead of portus. It works fine:

https://hub.docker.com/r/konradkleine/docker-registry-frontend/


(Jhdulla) #3

Thank you for the suggestion. I am also using this one. My problem now is that I can’t delete my images (maybe there are configurations I am using). Also in this design, could you implement a login so that only authorized users can access?


(Eldeberde) #4

Hi, I have implemented the login with nginx so its Nginx the responsible of auth the users.

To delete you need to enable it in the config:

cat /data/docker/config.yml
version: 0.1
log:
  fields:
  service: registry
storage:
    cache:
        blobdescriptor: inmemory
    filesystem:
        rootdirectory: /var/lib/registry
    delete:
        enabled: true

Regards


(Jhdulla) #5

Hello sir, What version you are using for docker-registry-frontend and docker private registry? I already applied your configuration but unable to show the delete button.


(Eldeberde) #6

Hi, in v2 is not yet implemented i think, this is the feauture request

Im using a custom script which use the registry api:

i create a file with the name of each repository with the tags to be deleted, and run this script:

$ cat registryClean.sh 
    #!/bin/bash
    rm tempscript.sh
    image=$(basename -- "$1")
    while IFS='' read -r line ;do
        variable=$(curl -v --silent -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X GET "http://localhost:5000/v2/"$image"/manifests/"$line"" 2>&1 | grep Docker-Content-Digest | awk '{print ($3)}')
        echo $variable
        url="http://127.0.0.1:5000/v2/$image/manifests/$variable"
        url=${url%$'\r'}
        curlcommand="curl  -vvvv  -H \"Accept: application/vnd.docker.distribution.manifest.v2+json\" -X DELETE "$url
        echo $curlcommand >> tempscript.sh
    done < "$1"
    sh tempscript.sh




$ cat magento
sprint-3
sprint-8




$ sh registryClean.sh magento

./registryClean.sh magento
sha256:4c1fb0c552f852ccd30e1ca3f85555f2752f0960a3ea3feb9bc2c501a3ff24c6
sha256:bfc1e8889b85e74d4eab864f97a42ff36dd088f96b739edb90b31b520ee4014c
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0)
> DELETE /v2/magento/manifests/sha256:4c1fb0c552f852ccd30e1ca3f85555f2752f0960a3ea3feb9bc2c501a3ff24c6 HTTP/1.1
> Host: 127.0.0.1:5000
> User-Agent: curl/7.47.0
> Accept: application/vnd.docker.distribution.manifest.v2+json
> 
< HTTP/1.1 202 Accepted
< Docker-Distribution-Api-Version: registry/2.0
< X-Content-Type-Options: nosniff
< Date: Wed, 12 Sep 2018 11:26:56 GMT
< Content-Length: 0
< Content-Type: text/plain; charset=utf-8
< 
* Connection #0 to host 127.0.0.1 left intact
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0)
> DELETE /v2/magento/manifests/sha256:bfc1e8889b85e74d4eab864f97a42ff36dd088f96b739edb90b31b520ee4014c HTTP/1.1
> Host: 127.0.0.1:5000
> User-Agent: curl/7.47.0
> Accept: application/vnd.docker.distribution.manifest.v2+json
> 
< HTTP/1.1 202 Accepted
< Docker-Distribution-Api-Version: registry/2.0
< X-Content-Type-Options: nosniff
< Date: Wed, 12 Sep 2018 11:26:56 GMT
< Content-Length: 0
< Content-Type: text/plain; charset=utf-8
< 
* Connection #0 to host 127.0.0.1 left intact

And when finish with all the repositories run this command to delete the files from filesystem:

$ /bin/registry garbage-collect /etc/docker/registry/config.yml

Regards