Skip to content

Bad Gateway after containers have been updated by Watchtower #763

@fortysix2ahead

Description

@fortysix2ahead

I experience the following behaviour for now several months now (have been using caddy-proxy for much longer time already): I am running dozens of containers which are exposed by caddy-proxy. They live in two docker networks ("caddy" and "caddy_int"). Both are configured via the environment variable CADDY_INGRESS_NETWORKS. So far, so good, everything's running smoothly - until a container is updated automatically by Watchtower. After Watchtower takes down a container and spins up a new one, they service is not accessible any longer. Caddy responds with 502 - bad gateway. This does not happen every time, but on a regular basis. After restarting the caddy container everything is fine again.

My guess is the following: when the container is updated and gets the same IP inside the docker network, all is fine. When the new container gets a new IP, different from the old one, caddy responds with 502 because all requests are sent into nirvana now. It looks like caddy is not notified that a new IP is used.

I am using caddy.reverse_proxy: {{upstreams http xxxx}} which resolves to an ip address. And if this address changes, things break.

I can't tell when I started to observe this behaviour. I am a long term user and I think caddy-proxy 2.8.x was still fine. 2.9 or 2.10 introduced the behaviour for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions