mirror of
https://github.com/crazy-max/diun.git
synced 2025-01-26 08:48:50 +00:00
74 lines
1.5 KiB
Markdown
74 lines
1.5 KiB
Markdown
# Basic example
|
|
|
|
In this section we quickly go over a basic Docker Compose file to run Diun
|
|
using the docker provider.
|
|
|
|
## Setup
|
|
|
|
Create a `docker-compose.yml` file that uses the official Diun image:
|
|
|
|
```yaml
|
|
name: diun
|
|
|
|
services:
|
|
diun:
|
|
image: crazymax/diun:latest
|
|
container_name: diun
|
|
command: serve
|
|
volumes:
|
|
- "./data:/data"
|
|
- "/var/run/docker.sock:/var/run/docker.sock"
|
|
environment:
|
|
- "TZ=Europe/Paris"
|
|
- "LOG_LEVEL=info"
|
|
- "LOG_JSON=false"
|
|
- "DIUN_WATCH_WORKERS=20"
|
|
- "DIUN_WATCH_SCHEDULE=0 */6 * * *"
|
|
- "DIUN_WATCH_JITTER=30s"
|
|
- "DIUN_PROVIDERS_DOCKER=true"
|
|
- "DIUN_PROVIDERS_DOCKER_WATCHBYDEFAULT=true"
|
|
restart: always
|
|
```
|
|
|
|
Here we use a minimal configuration to analyze **all running containers**
|
|
(watch by default enabled) of your **local Docker** instance **every 6 hours**.
|
|
|
|
That's it. Now you can launch Diun with the following command:
|
|
|
|
```shell
|
|
docker compose up -d
|
|
```
|
|
|
|
If you prefer to rely on the configuration file instead of environment variables:
|
|
|
|
```yaml
|
|
name: diun
|
|
|
|
services:
|
|
diun:
|
|
image: crazymax/diun:latest
|
|
container_name: diun
|
|
command: serve
|
|
volumes:
|
|
- "./data:/data"
|
|
- "./diun.yml:/diun.yml:ro"
|
|
- "/var/run/docker.sock:/var/run/docker.sock"
|
|
environment:
|
|
- "TZ=Europe/Paris"
|
|
- "LOG_LEVEL=info"
|
|
- "LOG_JSON=false"
|
|
restart: always
|
|
```
|
|
|
|
```yaml
|
|
# ./diun.yml
|
|
|
|
watch:
|
|
workers: 20
|
|
schedule: "0 */6 * * *"
|
|
firstCheckNotif: false
|
|
|
|
providers:
|
|
docker:
|
|
watchByDefault: true
|
|
```
|