Local Discovery is not working in docker case

I have two docker containers.How do I configure local discovery addresses?

docker run --name st0 -d \
    -p 8385:8384 \
    -p 22000:22000  \
    -v $HOME/st0/st-cfg:/var/syncthing/config \
    -v $HOME/st0/st-sync:/var/syncthing \
    -e STTRACE=events \
    syncthing/syncthing:latest

docker run --name st1 -d \
    -p 8386:8384 \
    -p 22001:22000  \
    -v $HOME/st1/st-cfg:/var/syncthing/config \
    -v $HOME/st1/st-sync:/var/syncthing \
    -e STTRACE=events \
    syncthing/syncthing:latest

Local discovery uses broadcasts and multicasts on the local network. Docker provides a separate network for each container (this is a major part of the “container” bit). I do not think you can get local discovery working between Docker containers, but I’m not a Docker expert. Maybe you can create a named network in Docker and wire both containers to it.

1 Like

Very helpful! Thank you

Typically you will only get local discovery working if you use the --net=host option. This basically wires your container network directly to the docker host network, meaning you won’t need to do things like port forwarding definitions. You lose some of the isolation provided by the container though, so make sure you’re ok with that.

1 Like