Docker Volume Analyzer is a tool designed to simplify the management of Docker volumes. It provides features to:
- Visualize the containers associated with each volume.
- Explore the contents of volumes and delete files if needed.
- Retrieve basic information about volumes, such as size and usage.
- Streamline volume management tasks for improved efficiency.
This project aims to make Docker volume management more intuitive and user-friendly.
- Python
>=3.13,<4.0.0 - Poetry
>=2.1.2installed globally (installation link) - Docker installed locally (if you want to analyze volumes)
git clone https://github.com/glefer/docker-volumes-analyzer.git
cd docker-volumes-analyzerpoetry installpoetry run start
⚠️ The application uses the Docker socket at the standard location:/var/run/docker.sock
Don't want to install Python? Simply use the Docker image:
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -ti glefer/docker-volumes-analyzer:latestdocker run --rm -v /var/run/docker.sock:/var/run/docker.sock -ti glefer/docker-volumes-analyzer:0.1.0The application supports multiple modes of operation. You can specify the mode using the APP_MODE environment variable. The available modes are:
- CLI mode (
start): Runs the application in command-line interface mode. - Web development mode (
web): Starts the application in web development mode. - Gunicorn mode (
gunicorn): Runs the application using Gunicorn as the WSGI server.
You can run the application in different modes by setting the APP_MODE environment variable when running the Docker container.
docker run --rm -e APP_MODE=start -v /var/run/docker.sock:/var/run/docker.sock -ti glefer/docker-volumes-analyzer:latestdocker run -e APP_MODE=web -v /var/run/docker.sock:/var/run/docker.sock glefer/docker-volumes-analyzer:latestdocker run -e APP_MODE=gunicorn -v /var/run/docker.sock:/var/run/docker.sock glefer/docker-volumes-analyzer:latestIf you prefer to run the application locally without Docker, you can use the entrypoint.sh script directly. Make sure you have all dependencies installed via Poetry.
APP_MODE=start scripts/entrypoint.shAPP_MODE=web scripts/entrypoint.shAPP_MODE=gunicorn scripts/entrypoint.shWhen running the application in web or gunicorn mode, it exposes a Prometheus metrics endpoint at /metrics. This endpoint provides detailed metrics about Docker volumes, such as:
- Total number of Docker volumes.
- Size of individual Docker volumes (in bytes).
For more information about the metrics exposed and how to integrate them with Prometheus, refer to the Prometheus documentation.
poetry run pytestWith coverage:
poetry run pytest --cov=docker_volume_analyzerStart a virtual shell:
poetry shellFormatting and checks:
poetry run pre-commit run --all-files.
├── src/
│ └── docker_volume_analyzer/
│ └── main.py # Entry point
├── tests/
├── README.md
├── pyproject.toml
└── poetry.lock
Contributions are welcome! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/my-feature). - Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature/my-feature). - Open a pull request.
For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT license — see the LICENSE file.
