lucaslorentz / caddy-docker-proxy

Caddy as a reverse proxy for Docker
MIT License
3.02k stars 173 forks source link

Support for multiple controllers #335

Open Firerouge opened 2 years ago

Firerouge commented 2 years ago

Running a 3 replica caddy cluster. Works great with swarm services.

Containers with devices can't be run in swarm mode, they can still be proxied to with labels when ran via docker-compose, but only if the controller is running on the same node with the container's docker.sock.

You can spin up 3 replicas of the controller, but they seem to overwrite each other's configs. Only one node at a time will have it's non swarm containers proxied, whichever node had a container with caddy labels restarted/updated most recently.

Piehthyte commented 2 years ago

The environment variable CADDY_DOCKER_SOCKETS can be used for multiple docker sockets. You don't really need multiple controllers, just separate the docker socket variable for each host CADDY_DOCKER_SOCKETS: "host1, host2" or CADDY_DOCKER_SOCKETS="host1, host2" You can use something like drakulix/shipwreck if you're not interested in manually forwarding your docker socket. I hope this helps!