Small binary to clean up docker images (mostly in CI)
This repository has been archived on 2024-03-03. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
DataHearth 072f3120db
add makefile instructions
2022-02-17 22:28:56 +01:00
src add date option 2022-02-17 21:00:08 +01:00
.dockerignore update .dockerignore 2022-02-17 22:22:05 +01:00
.gitignore add README.md 2022-02-09 00:03:09 +01:00
Cargo.lock bump version 2022-02-17 21:01:40 +01:00
Cargo.toml bump version 2022-02-17 21:01:40 +01:00
Dockerfile use dind-alpine image 2022-02-17 22:19:13 +01:00
LICENSE add license 2022-02-09 00:04:02 +01:00
Makefile add makefile instructions 2022-02-17 22:28:56 +01:00
README.md update README.md 2022-02-17 22:17:13 +01:00

README.md

clear-docker-images

clear-docker-images is a small rust binary made to cleanup old docker images but date, repository and tags.

Usage

By default (it will change in the futur), clear-docker-images will select images that are older than 2 days old. You can choose to customize which repository will be selected and if specific tags should be ignored.

Docker container

docker run --name clear-docker-image -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/datahearth/clear-docker-images <OPTIONS>

Binary

mkdir -p $HOME/.local/bin
export PATH=$PATH:$HOME/.local/bin

# Available distribution: linux | darwin
wget -o $HOME/.local/bin/clear-docker-images ~/. https://github.com/DataHearth/clear-docker-images/releases/download/<VERSION>/x86_x64-<DISTRIBUTION>-clear-docker-images

clear-docker-images <OPTIONS>

Source

git clone https://github.com/DataHearth/clear-docker-images.git
cd clear-docker-images
cargo install --path .

clear-docker-images <OPTIONS>

Flags

  -d, --date <DATE>                filter by repository name (ISO 8601) [default: $NOW - 2 days]
      --dry-run                    image cleanup will not be triggered
      --force                      should docker force image removal (it may create orphan images)
  -h, --help                       Print help information
  -r, --repository <REPOSITORY>    filter by repository name
  -t, --tags <TAGS>                add tags exclusion Example: -t 1.1.0 -t release
  -v, --verbose                    add more logs
  -V, --version                    Print version information