diff --git a/.gitignore b/.gitignore index ea8c4bf..35058a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +.DS_STORE \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index d4408e4..3fb69b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,8 +3,10 @@ name = "clear-docker-images" version = "0.2.0" edition = "2021" authors = ["Antoine Langlois"] - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +description = "small binary to clean old docker images (mostly in CI)" +repository = "https://github.com/DataHearth/clear-docker-images" +homepage = "https://github.com/DataHearth/clear-docker-images" +readme = "README.md" [dependencies] serde = { version = "1.0", features = ["derive"] } diff --git a/README.md b/README.md new file mode 100644 index 0000000..02ab8c6 --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# clear-docker-images + +`clear-docker-images` is a small rust binary made to cleanup old docker images but date, repository and tags. + +## Usage + +### Docker container + +```bash +docker run --name clear-docker-image -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/datahearth/clear-docker-image +``` + +### Binary + +```bash +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/v0.2.0/x86_x64--clear-docker-images + +clear-docker-images +``` + +### Source + +```bash +git clone https://github.com/DataHearth/clear-docker-images.git +cd clear-docker-images +cargo install --path . + +clear-docker-images +``` + +## Flags + +`--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 ` : filter by repository name +`-t, --tags ` : add tags exclusion +`-V, --version` : Print version information