Dockerized syncthing instances cannot see each other

Hi, hoping someone here can help.

I’m using syncthing on multiple devices on my network, 1 desktop, 1 laptop and 2 other machines I use as servers (and hopefully more devices to come). I have syncthing running in docker containers on the two servers (one is an unraid install, the other is just plain ubuntu server install). The syncthing installs on every machine can see all the others, except the two docker instances which refuse to see each other at all (and only each other). Both containers are set up correctly as far as I can tell, both using docker Host networking. I’ve tried fresh installs of both (wiped the configs etc) but no go.

Tearing my hear out slightly here, so hope there are some helpful hints to be had here. I wondering if it is some docker related snag but I’m otherwise at a loss.

thanks!

I think docker by default uses NATed networking, so things like local discovery etc will simply not work.

If I’m not mistaken, the only few ways they can connect is either:

  1. Relay
  2. Hardcoded ips
  3. Map port on the host that matches the internal port of the container (so that discovery would work, which means you need to configure one of them to listen on a different port)
  4. Being in the same network namespace as the other container, but different ip, and hope that docker nat supports multicasts/broadcasts.

There is no upnp on the machine running the containers so there is no way this could work in any other way.

2 Likes

Hi, thanks for the reply

The docker containers are on separate devices, each with their own ip and using docker “host” networking. I was under the impression that should mean that each container should appear to run as if on the host machine. Certainly local discovery works otherwise, with each docker container able to see all other machines on the network (and vice versa) but just not each other (again, they are hosted in containers on separate physical machines, so I don’t understand why this is so).

Upshot is that I was able to connect them by manually specifying the ip address, so all is sorted in this respect anyway.

thanks!

I guess you could see what ips they discover for each other to try and understand why they don’t connect.

Is syncthing able to see its own IP in that case?

yeah. Each docker container works perfectly fine with other non dockerized instances. I can even ping each container from the other (by docker shelling into each container) so they definitely can connect to each other. But the auto discovery just does not want to work. It’s no big hardship to manually enter the IP, but just seems curious to me that it doesn’t work in this case.

Anyone else able to replicate this behaviour?

Firewalls?

none

1 Like

Do you have global discovery enabled for both devices? If yes, you could examine which addresses get published by each node and check the LAN addresses.

You can query the global discovery server from your browser using the full device id:

https://discovery.syncthing.net/?device=XXXX-XXXX-XXXX-XXXX-

1 Like

I did not, but with Global discovery now enabled I can see that the correct local IPs get published for each container but still wont auto detect each other. Just to test, I installed syncthing app on my phone, and it was spotted immediately by all the other instances, the 2 docker ones included.

If they’re both able to access the global discovery server and exchange their local IPs,i’m at my wits’ end.

Any dialing attempts in the logs?

Yeah you could enable connection debugging and see what goes wrong.

I’m not 100% sure if this is what fixed the issue or not but on my ubuntu server I was using a static ip plus google namesevers. I switched this to dhcp (and assigned ip on the router instead), and regenerated the netplan config. And now local discovery works…

Unfortunately I actually practiced bad troubleshooting etiquette as I also added a wifi adapter temporarily at the same time to see if it made a difference as I am using homeplug adapters to connect these two servers to the rest of the home. I had a theory that maybe the homeplug adapters themselves were interfering in some way, but now it all just works even when back to the original set up (minus the static ip)

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.