README.md 2.35 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# containinator

A simple Clojure command line app to instruct GitLab to clean Docker image tags for all projects.
It uses the GitLab REST API (v4) to retrieve project information and sending bulk deletion requests for tags.
The app can be used to list projects and their number of registry repositories and tags as well.

The app is meant to be used in conjunction with [GitLab's docker-distribution-pruner](https://gitlab.com/gitlab-org/docker-distribution-pruner).
The `docker-distribution-pruner` cli app seems to delete more of the orphaned image data than the built in `gitlab-ctl registry-garbage-collect`.
For this reason you should probably use `docker-distribution-pruner` after running containinator.

## Installation

TBD

### Caveat

Currently binaries compiled with GraalVM's native-image does not hardlink the `sunec` dependency.
If you are running the binary on its own you need to supply the sunec library via an openjdk or graalvm installation.
There is [an issue](https://github.com/oracle/graal/issues/1336) about this in the official graal repository.

For the time being you can run the binary with `containinator -Djava.library.path=/<path to java/graal>/lib/`.
The Docker image will bundle the sunec dependency.


## Usage

```bash
./containinator --help
```

There are two sub-commands in the app:

- locate
- terminate

The `locate` command lists projects and key stats about the project's container registry.
The `terminate` command sends bulk tag deletion commands for all projects with a container registry.


## Examples

```bash
./containinator -Djava.library.path=$JAVA_HOME/lib/ --token <yourtoken> --gitlab https://gitlab.<yourdomain>.<tld> locate --sort tag-count --limit 20
Locating projects for given arguments on https://gitlab.nsd.no Please be patient, it could take some time.


| :id |                 :name | :registry-count | :tag-count |
|-----+-----------------------+-----------------+------------|
| 123 |             project-a |               1 |         28 |
| 242 |             project-b |               1 |         27 |

```

## Development

...



...


## License

Copyright © 2019 NSD - Norsk senter for forskningsdata AS

Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.

The `links.clj` file is verbatim copied from [clj-http](https://github.com/dakrone/clj-http) and retains its original license.