Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple DockerHost to restart containers in different vms #195

Open
t-abraham opened this issue Dec 11, 2024 · 1 comment
Open

Multiple DockerHost to restart containers in different vms #195

t-abraham opened this issue Dec 11, 2024 · 1 comment

Comments

@t-abraham
Copy link

Containers restart #1 you added the option to restart containers using the RESTART_CONTAINERS env var and the use of DOCKER_HOST to add the proxy. But is it possible to add support for multiple docker hosts? Like this

version: "3.7"

services:
  test:
    image: ghcr.io/kereis/traefik-certs-dumper:latest
    restart: always
    environment:
      - DOCKER_HOST=10.20.30.101:2375,10.20.30.102:2375,10.20.30.103:2375
      - RESTART_CONTAINERS=container1,container2,container3

here container1 is at 10.20.30.102:237, container2 is at 10.20.30.103:237, container3 is at 10.20.30.101:237

something like this...

@kereis
Copy link
Owner

kereis commented Dec 13, 2024

I can't tell if DOCKER_HOST accepts multiple hosts, but if it's as simple as swapping out DOCKER_HOST, then I could add some kind of env var for setting a mapping table (either as JSON or as a list of key-values).

It could look something like this:

services:
  test:
    image: ghcr.io/kereis/traefik-certs-dumper:latest
    restart: always
    environment:
      - DOCKER_HOST_MAPPING={
            "10.20.30.101:2375": [
                "container1"
            ],
            "10.20.30.102:2375": [
                "container2"
            ]
            "10.20.30.103:2375": [
                "container3"
            ]
         }
      - RESTART_CONTAINERS=container1,container2,container3

or we could go ahead, skip DOCKER_HOST, and instead specify the Docker host for each container - either in the same fashion as DOCKER_HOST_MAPPING above, or {docker_host}:{container_name}.

services:
  test:
    image: ghcr.io/kereis/traefik-certs-dumper:latest
    restart: always
    environment:
      - RESTART_CONTAINERS=10.20.30.102:237=container1,10.20.30.102:2375=container2,10.20.30.103:2375=container3

The option above would make RESTART_CONTAINERS a bit cluttery if you specify way more containers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants