Docker image for rotating log files from other containers
3.0K
A lightweight Docker image that performs log rotation for other containers running in the same Docker environment.
Choose the right version for your environment:
latest: Latest stable build - recommended for testing1.2.3: Specific version - recommended for productionExample: wydler/logrotate:1.2.3
This container runs logrotate to manage log files from other containers in your Docker environment. It helps prevent log files from growing too large and consuming all available disk space.
services:
# Example service that generates logs
app:
image: your-app-image
volumes:
- logs:/logs
# Logrotate service
logrotate:
image: wydler/logrotate:latest
volumes:
- logs:/logs
environment:
TZ: "Europe/Berlin"
LOGS_PATH: "/logs/*.log"
TRIGGER_INTERVAL: daily
MAX_SIZE: 100M
MAX_BACKUPS: 30
DELAYCOMPRESS: "true"
volumes:
logs:
driver: local
| Variable | Description | Default | Options |
|---|---|---|---|
LOGS_PATH | Path to log files to rotate | /logs/*.log | Any valid path pattern |
TRIGGER_INTERVAL | How often to rotate logs | daily | hourly, daily, weekly, monthly, yearly |
MAX_SIZE | Rotate if log file size reaches this threshold | NONE | NONE or size (e.g., 1K, 10M, 1G) |
MAX_BACKUPS | Number of backup copies to keep | 365 | Any positive integer |
DELAYCOMPRESS | Delay compression of rotated logs until next rotation | true | true, false |
TZ | Timezone | UTC | Any valid timezone (e.g., Europe/Berlin) |
This project is licensed under the MIT License.
Content type
Image
Digest
sha256:7cf530d44…
Size
5.9 MB
Last updated
5 months ago
docker pull wydler/logrotate