Traefik Networking Issues
Issue
I recently had an issue with Traefik and Docker where one of my services running Apache (FreshRSS) would be intermittently be unavailable and have the following quirks:
- It would be accessible by localhost via curl from within it’s own container:
curl localhost:80
->200 OK
- It would be accessible by service name via curl from within it’s own container:
curl freshrss:80
->200 OK
- It would be accessible by service name via curl from within the Traefik container:
curl freshrss:80
->200 OK
Problem
I’ll do a full write-up on it later, but for now, the issue turned out to be the result of the FreshRSS being on two networks (one for the database and one for the proxy). Traefik wasn’t always selecting the correct network and thus connections were attempted over the database network (of which Traefik isn’t a part), which would fail.
Solution
The solution was to:
- Set the
traefik.docker.network
label on the FreshRSS service:- traefik.docker.network=proxy