Configuration
Configuration of the service is done via environment variables.
General Configuration
| Name | Type | Default | Description |
|---|---|---|---|
DOLCE_LOG_LEVEL |
Deno Log Level 1 | INFO |
Loglevel of the service |
DOCKER_HOST |
string? |
/var/run/docker.sock |
Path to the docker socket or an ip:port-pair when used with DOCKER_TRANSPORT=tcp |
DOCKER_TRANSPORT |
unix | tcp |
unix |
Transport used to talk to docker |
DOLCE_SUPERVISION_LABEL |
string? |
dolce.enabled |
See Supervision Mode |
DOLCE_IDENTIFIER_LABEL |
string? |
dolce.identifier |
See Container Identifiers |
DOLCE_SUPERVISION_MODE |
ALL | TAGGED |
ALL |
See Supervision Mode |
DOLCE_ACTOR_IDENTIFIER |
name | image |
name |
See Container Identifiers |
DOLCE_EVENTS |
Container Action[] 2 | All available | See Event Selection |
DOLCE_MIN_TIMEOUT |
number |
10 | See Notification Backoff |
DOLCE_MAX_TIMEOUT |
number |
606024 | See Notification Backoff |
DOLCE_MULTIPLIER |
number |
10 | See Notification Backoff |
DOLCE_LOCKFILE |
string |
/var/run/dolce/lockfile |
See Lockfile |
DOLCE_CUSTOM_TEMPLATE_PATH |
string? |
/var/dolce-custom-templates/ |
See Custom Templates |
Supervision Mode
If the variable DOLCE_SUPERVISION_MODE is set to the string TAGGED, only containers with the tag specified in
DOLCE_SUPERVISION_LABEL and a value of true will create events. If instead set to ALL or unset, all containers are
supervised.
services:
dolce:
image: dangrie158/dolce
...
environment:
DOLCE_SUPERVISION_MODE: TAGGED
DOLCE_SUPERVISION_LABEL: monitor.enable
importantservice:
labels:
monitor.enable: true # (1)!
unimportantservice:
labels:
monitor.enable: false # (2)!
anotherunimportantservice:
... # (3)!
- will create notifications, the label is set to exactly "true"
- won't create notifications, the label is explicitly set to a value other than "true"
- won't create notifications, the label is not set at all
Container Identifiers
By default Dolce will use the container name in notifications to identify the container that changed the state. If you
set DOLCE_ACTOR_IDENTIFIER to image, the name of the dockerimage is used instead. You can also specify a custom
identifier per container by adding a label with the key specified in DOLCE_IDENTIFIER_LABEL to your container.
For example:
services:
dolce:
image: dangrie158/dolce
...
environment:
DOLCE_ACTOR_IDENTIFIER: image
DOLCE_IDENTIFIER_LABEL: dolce.label # (1)!
importantservice:
labels:
dolce.label: "my_important_service_do_not_kill" # (2)!
anotherimportantservice:
... # (3)!
dolce.identifierby default- using the label specified in
DOLCE_IDENTIFIER_LABEL, this container will be referred to asmy_important_service_do_not_killin any notifications - This container will be referred to by its image name due to the setting of
DOLCE_ACTOR_IDENTIFIER=image
Event Selection
By default you will get notified for a subset of all available events that are fired by the Docker Engine: start
diekilloomstoppauseunpausehealth_status
You can narrow this list down or expand it by setting the DOLCE_EVENTS setting. If you are for example only interested
in die and start events you can set:
dolce:
image: dangrie158/dolce
...
environment:
DOLCE_EVENTS: die:start
This is the list of all available events:
attach, commit, copy, create, destroy, detach, die, exec_create, exec_detach, exec_start, export,
health_status, kill, oom, pause, rename, resize, restart, start, stop, top, unpause, update.
Lockfile
The lockfile is used to detect unexpected shutdowns and avoid mutliple instances of the service running at the same time. You can mount this path in a volume to detect unexpected shutdowns outside of the lifetime of the container.
If you plan on using multiple instances of Dolce (e.g. to enable multiple configurations) make sure that if this is mounted in a volume, no two different services access the same file.