Coder Social home page Coder Social logo

hcguersoy / cleanreg Goto Github PK

View Code? Open in Web Editor NEW
54.0 54.0 18.0 155 KB

A small tool to clean up Docker Registries (v2).

License: Apache License 2.0

Python 32.65% Shell 67.09% Dockerfile 0.26%
docker docker-image docker-registry garbage-collection python registry registry-server

cleanreg's People

Contributors

bvis avatar derwebcoder avatar dev0xjonas avatar hcguersoy avatar juliansauer avatar kekru avatar slamdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cleanreg's Issues

Delete at least the tag if using ignore option

Hi,

the ignore option will not delete a digest if two or more tags are pointing to it.

Is there a way in this case to delete the tag (not the digest) at least? Otherwise the tag will never be deleted and the same problem occurs the next time we execute cleanreg. In the worst case cleanreg can not delete digests anymore, because there are to many digests with two or more tags.

I would implement this. But i do not find any registry api request which seems to delete a tag. Do you know if there is a way to do this?

Cannot remove images

As far as I understand when we want to delete an image (with all its versions) we need to put the "keepimages" parameter to 0. But it does not work as expected. You can see it easily in the next example (I'm using a local built image to execute it).

$ docker run --rm -it cleanreg -r http://$REGISTRY_IP:5000 -v -n busybox2 --keepimages 1
Check if registry server supports v2...
Registry server supports v2!
==================================================>> 100%
will delete repo busybox2 and keep 1 images.
Skipping because found not enough images which can be deleted.
Aborted by user or nothing to delete.

$ docker run --rm -it cleanreg -r http://$REGISTRY_IP:5000 -v -n busybox2 --keepimages 0
usage: cleanreg.py [-h] [-v] -r REGISTRY [-p] [-q] [-n REPONAME]
                   [-k KEEPIMAGES] [-f REPOSFILE]
cleanreg.py: error: [-n] and [-k] has to be used together.

Deleting wrong images if tagged more than once

cleanreg deletes images which are tagged twice, even if setting --ignore option. Looks like --ignore is only checking for duplicates in the same repository.

Having an image example-a:test-123 and tagging it additionally example-b:test-123. Both will have the same digest. Running cleanreg for example-b and deleting the image, it will also delete example-a, even if --ignore option has been set.

Docker registry using token authentication

Is there any way to use this for registries using token-based authentication or else is it possible to add a feature where it will use an existing docker registry credential for authentication?

runAllTests.sh is not working

See attached log file.

I assume the cause is the following:

Create images for registry and cleanreg
Using Docker Registry in version 2.5.1. You can define the version by setting the REGISTRYTAG env variable
Sending build context to Docker daemon  3.072kB
Step 1/3 : ARG TAG
Please provide a source image with `from` prior to commit
Sending build context to Docker daemon  3.072kB
Step 1/4 : ARG BASEIMAGE
Please provide a source image with `from` prior to commit
Sending build context to Docker daemon  235.5kB

I have installed docker-ce 17.03.1ce-0ubuntu-xenial

runAllTests.txt

`-s` or `-d`?

The shorthand for --date is -s in 1 place README.md and -d in another.

Rename --quiet/-q option to --assume-yes or --yes/-y

I think it would be more obvious to rename the --quiet option to --assume-yes like in "apt" or other similar tools.
In the end --quiet does not even reduce the logs but just assume yes for the user interaction.

KeyError: 'history'

I am running docker run --rm -it hcguersoy/cleanreg:v0.7.0 -r https://myregistry -cf -k 5 -i and get the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/multiprocessing/process.py", line 267, in _bootstrap
    self.run()
  File "/usr/local/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/cleanreg.py", line 534, in get_tags_dates_digests_byrepo
    pool.map(funcpart, tags_all)
  File "/usr/local/lib/python2.7/multiprocessing/pool.py", line 253, in map
    return self.map_async(func, iterable, chunksize).get()
  File "/usr/local/lib/python2.7/multiprocessing/pool.py", line 572, in get
    raise self._value
KeyError: 'history'

Traceback (most recent call last):
  File "/cleanreg.py", line 678, in <module>
    args.md_workers, args.cacert)
  File "/cleanreg.py", line 583, in get_all_tags_dates_digests
    result[repo] = repos_tags_digest[repo]
  File "<string>", line 2, in __getitem__
  File "/usr/local/lib/python2.7/multiprocessing/managers.py", line 774, in _callmethod
    raise convert_to_error(kind, result)
KeyError: u'library/postgres'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.