Hi,
I’ve been using Docker on my small computers for a long time now. In particular, I’ve been running the LinuxServer team’s Swag container as a reverse proxy to many other containers, including Portainer, for several years, without much trouble. However since a few weeks or months, one strange thing has been happening. For context, even though I have some other computers around this also running Docker containers, the following all happens inside one Raspberry Pi 4 computer, running a recently updated Raspberry Pi OS.
I access the Portainer container one of 2 ways. One way is through the LAN IP of the Raspberry, connecting to the port exposed by Docker for that purpose. This works flawlessly and Portainer behaves as usual. The other way is through the reverse proxy, which, even inside the local network, is now behaving erratically (again, this is a fairly recent development). What happens is that I can use Portainer somewhat, but every few page loads, I’m redirected to the login page, as if I had just logged out myself. Looking at the nginx logs, I find errors about “host unreachable” when this happens:
2024/11/22 12:29:31 [error] 933#933: *19703 connect() failed (113: Host is unreachable) while connecting to upstream, client: EDITED, server: home.*, request: "GET /portainer/api/users/me HTTP/2.0", upstream: "http://172.18.0.15:9000/api/users/me", host: "EDITED", referrer: "https://EDITED/portainer/"
To confirm the networking nature of the issue, I ran a shell inside the nginx container:
root@aa1dd0d5edeb:/# ping 172.18.0.15
PING 172.18.0.15 (172.18.0.15): 56 data bytes
64 bytes from 172.18.0.15: seq=1 ttl=64 time=0.190 ms
64 bytes from 172.18.0.15: seq=3 ttl=64 time=0.308 ms
64 bytes from 172.18.0.15: seq=5 ttl=64 time=0.344 ms
64 bytes from 172.18.0.15: seq=9 ttl=64 time=0.183 ms
64 bytes from 172.18.0.15: seq=10 ttl=64 time=0.184 ms
64 bytes from 172.18.0.15: seq=11 ttl=64 time=0.171 ms
64 bytes from 172.18.0.15: seq=13 ttl=64 time=0.300 ms
64 bytes from 172.18.0.15: seq=15 ttl=64 time=0.294 ms
64 bytes from 172.18.0.15: seq=19 ttl=64 time=0.164 ms
64 bytes from 172.18.0.15: seq=21 ttl=64 time=0.172 ms
64 bytes from 172.18.0.15: seq=23 ttl=64 time=0.177 ms
I’m no ping expert, but I would say that the sequence numbers indicate that some ping packets are received as expected, but many are lost.
I also used wget on the portainer URL that last failed to confirm it’s about host unreachable:
root@aa1dd0d5edeb:/# wget http://172.18.0.15:9000/api/users/me
Connecting to 172.18.0.15:9000 (172.18.0.15:9000)
wget: server returned error: HTTP/1.1 401 Unauthorized
root@aa1dd0d5edeb:/# wget http://172.18.0.15:9000/api/users/me
Connecting to 172.18.0.15:9000 (172.18.0.15:9000)
wget: server returned error: HTTP/1.1 401 Unauthorized
root@aa1dd0d5edeb:/# wget http://172.18.0.15:9000/api/users/me
Connecting to 172.18.0.15:9000 (172.18.0.15:9000)
wget: can't connect to remote host (172.18.0.15): Host is unreachable
The first 2 times it worked (of course the unauthorized reply is expected here; interestingly the second call was a bit slower to respond), and the 3rd one failed. This pattern can be reproduced at will, with some randomness to it.
Also interestingly, to the best of my knowledge, NONE of the other containers I run seem to cause such issues, things are working well for every other service I run (unless I’m just not seeing it yet…). And the issue survives reboots, it’s a permanent situation. But then again, I don’t think it’s a Portainer issue since accessing the container without the reverse proxy works fine, as mentioned.
What could be happening here? I’m primarily looking for pointers on how to further investigate this issue, as I feel stuck. My networking and docker knowledge is fairly basic - I guess I know just enough to be frustrated by the thought that this doesn’t make any sense
Thanks in advance to anyone who could help.
Pierric.