ItsEcholot / ContainerNursery

Puts Docker Containers to sleep and wakes them back up when they're needed
MIT License
94 stars 6 forks source link

Use Labels from Docker Compose #49

Open accforgithubtest opened 12 months ago

accforgithubtest commented 12 months ago

Feature request - To make it easier to use with docker compose, and avoiding multiple / duplicated configurations for each container, ContainerNursery should support using labels in the docker-compose.yml file, for all configurations that currently goes in config.yml.

For example, traefik and caddy allow the configuration of proxy using just the labels in docker-compose file like this (caddy-docker-proxy example) -

pihole:
    container_name: pihole
    image: ...
    ...
    labels:
          caddy: pihole.local.host
          caddy.reverse_proxy: "{{upstreams 80}}"

So it would be great if something like below can be supported from docker-compose, to enable containerNursery to manage the stop/start of containers.

pihole:
    container_name: pihole
    image: ...
    ...
    labels:
        caddy: pihole.local.host
        caddy.reverse_proxy: "{{upstreams 80}}"
        containernursery.enabled: true
        containernursery.containersInGroup: pihole, wordpress, mariadb
        containernursery.timeoutSeconds: 30
        containernursery.stopOnTimeoutIfCpuUsageBelow: 50

As you can see, this would allow the docker-compose file to remain the primary configuration location, avoid repeating the configurations, and simplify the user experience.