ofelia
ofelia copied to clipboard
job-run add label to container
i use the job-run to start an php container and run a php script every 5 minutes.
the docker run command should be something like this:
docker container run --rm --hostname testHostname -volume /mnt/point:/ofelia/php --label traefik.http.services.php.loadbalancer.server.port=80 php:8.2-cli /ofelia/php/update.php
my labels in the the docker-compose.yaml for ofelia are like this:
services:
ofelia:
....
labels:
- "ofelia.job-run.netcupDns.schedule=@every 5m"
- "ofelia.job-run.netcupDns.image=php8.2-cli"
- "ofelia.job-run.netcupDns.volume=/mnt/point:/phpscripts"
- "ofelia.job-run.netcupDns.command=/phpscripts/update.php"
Now everything looks fine exept the --hostname testHostname
and --label traefik.http.services.php.loadbalancer.server.port=80
How do i add those labels to the container i am going to run?
I have a similar use case where I run a kopia
backup job from a container. The backups get tagged with the hostname of the container. I would like to pass in a hostname config to set the hostname of the instantiated container.