Crates.io | remove_docker_images |
lib.rs | remove_docker_images |
version | 0.2.1-beta.2 |
source | src |
created_at | 2021-12-14 03:56:53.594693 |
updated_at | 2021-12-14 04:04:53.451127 |
description | Remove obsolete docker images. |
homepage | |
repository | |
max_upload_size | |
id | 497556 |
size | 44,335 |
Remove obsolete docker images.
Install Docker.
The tags following this regex are supported:
^[vV]?(\d{1,5})(\.\d{1,5})?(\.\d{1,5})?(-.*)?$
ex) Supported tags:
1.0
1.0-SNAPSHOT
v2.10.1
2.0-BR291-SNAPSHOT
8-jdk
ex) Non supported tag:
123456.1 (major version has more than 5 digits)
ver1.2
If the tag matches the following regex, it is recognized as a canonical (non snapshot) version.
^[vV]?(\d{1,5})(\.\d{1,5})?(\.\d{1,5})?
If the tag ends with "-SNAPSHOT", it is recognized as a snapshot version.
If non "-SNAPSHOT" string follows, it is recognized as a branch.
ex) Branch: BR102(canonical version)
1.4-BR102
ex) Branch: BR102(snapshot version)
1.4-BR102-SNAPSHOT
Image name | tag |
---|---|
foo/myapp | 1.0 |
foo/myapp | 1.0-SNAPSHOT |
bar/app | 1.2 |
foo/myapp | 1.1 |
foo/myapp | 1.1-SNAPSHOT |
foo/myapp | 1.2 |
bar/app | 2.2 |
foo/myapp | 1.3 |
Image name | tag |
---|---|
foo/myapp | 1.0 |
foo/myapp | 1.0-SNAPSHOT |
foo/myapp | 1.3 |
foo/myapp | 1.1 |
foo/myapp | 1.1-SNAPSHOT |
foo/myapp | 1.2 |
bar/app | 2.2 |
bar/app | 1.2 |
Image name | tag |
---|---|
foo/myapp | 1.0-SNAPSHOT |
foo/myapp | 1.1-SNAPSHOT |
foo/myapp | 1.0 |
foo/myapp | 1.3 |
foo/myapp | 1.1 |
foo/myapp | 1.2 |
bar/app | 2.2 |
bar/app | 1.2 |
Image name | tag |
---|---|
foo/myapp | 1.0-SNAPSHOT |
foo/myapp | 1.1-SNAPSHOT |
foo/myapp | 1.0 |
foo/myapp | 1.1 |
foo/myapp | 1.2 |
foo/myapp | 1.3 |
bar/app | 1.2 |
bar/app | 2.2 |
Image name | tag | delete |
---|---|---|
foo/myapp | 1.0-SNAPSHOT | delete |
foo/myapp | 1.1-SNAPSHOT | keep |
foo/myapp | 1.0 | delete |
foo/myapp | 1.1 | keep |
foo/myapp | 1.2 | keep |
foo/myapp | 1.3 | keep |
bar/app | 1.2 | keep |
bar/app | 2.2 | keep |
--version
Show tool version.
--dry-run
Do not invoke "docker rmi" instead, just show the images that will be deleted.
--keep [count]
Specify keep count for canonical versions. Default to 3.
--keep-snapshot [count]
Specify keep count for snapshot versions. Default to 1.
--repository-type [type]
Specify docker image repository type. Can use 'docker' and 'ibmcr'. The 'docker' means docker image repository. The 'ibmcr' means IBM Cloud Registry. Default to 'docker'.
If you want to use IBM Cloud Registry, specify '--repository-type ibmcr'. In this case, you need to login IBM Cloud Registry in advance.
$ ibmcloud login
$ ibmcloud cr login
$ remove_docker_images --repository-type ibmcr
If you want to execute it in non-interactive environment such as in CI server, you can use API key.
$ export IBMCLOUD_API_KEY=YOUR_CONTAINER_REGISTRY_APIKEY
$ ibmcloud login
$ ibmcloud cr login
$ remove_docker_images --repository-type ibmcr
You can create API key at web console:
Linux(x86_64): 0.2.0