Sign inSign up

rafaelqsantosrqs/docker-cleanup

By rafaelqsantosrqs

โ€ขUpdated 10 months ago

Image
Developer tools
0

335

rafaelqsantosrqs/docker-cleanup repository overview

Docker Cleanup Banner

โ ๐Ÿงน Docker Cleanup Tool

Go Version Docker Compliant License

An automated, lightweight, and professional Go utility designed to keep your Docker environment lean and efficient. It safely removes unused resources without interrupting your active containers.


โ โœจ Key Features

  • โœ… Container Management: Automatically identifies and removes stopped containers.
  • โœ… Volume Pruning: Safely reclaims disk space by deleting orphan volumes.
  • โœ… Network Cleanup: Removes unused Docker networks.
  • โœ… Image Optimization: Prunes dangling and unused images (while preserving those in use).
  • โœ… Daemon Mode: Can run as a persistent background service with configurable intervals.
  • โœ… Cloud Ready: Fully Dockerized and OCI-compliant.

โ ๐Ÿš€ Getting Started

The most portable way to run the tool. Ideal for servers and CI/CD environments.

One-shot run:

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock rafaelqsantos/docker-cleanup

Running as a Daemon (Background Service):

docker run -d \
  --name docker-cleanup \
  -e CLEANUP_INTERVAL=24h \
  -v /var/run/docker.sock:/var/run/docker.sock \
  rafaelqsantos/docker-cleanup
โ ๐Ÿ’ป Option 2: Pre-compiled Binaries

Download the latest binaries for your platform from the Releasesโ  page.

# Example for Linux
./docker-cleanup-linux-amd64
โ ๐Ÿ› ๏ธ Option 3: Developer Setup

If you prefer running from source:

git clone https://github.com/rafael-qsantos/Management-go.git
cd Management-go
go run main.go

โ โš™๏ธ Configuration

Control the behavior of the tool using environment variables:

VariableDescriptionDefaultExample
CLEANUP_INTERVALTime to wait between cleanup cycles (Daemon Mode)Empty (Runs once)1h, 24h, 30m
DOCKER_HOSTDocker socket path (inherited from environment)unix:///var/run/docker.sock-

โ ๐Ÿค– CI/CD Automation

This project is fully automated via GitHub Actions:

  • Automated Releases: Every version tag (v*) triggers a multi-platform binary build.
  • Docker Publishing: Every release is automatically pushed to Docker Hub with latest and version tags.

โ ๐Ÿ“ License

Distributed under the MIT License. See LICENSE for more information.


Built with โค๏ธ by Rafael Queiroz Santos

Tag summary

Content type

Image

Digest

sha256:e417db51cโ€ฆ

Size

9.4 MB

Last updated

10 months ago

docker pull rafaelqsantosrqs/docker-cleanup