docs: Clarify docker network mode limitations (#8472)

This commit is contained in:
bt90 2022-07-31 20:46:57 +02:00 committed by GitHub
parent 5977868165
commit de7d62cc1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,7 +23,7 @@ $ docker run -p 8384:8384 -p 22000:22000/tcp -p 22000:22000/udp -p 21027:21027/u
``` ```
**Docker compose** **Docker compose**
``` ```yml
--- ---
version: "3" version: "3"
services: services:
@ -46,12 +46,14 @@ services:
## Discovery ## Discovery
Note that local device discovery will not work with the above command, Note that Docker's default network mode prevents local IP addresses from
resulting in poor local transfer rates if local device addresses are not being discovered, as Syncthing is only able to see the internal IP of the
manually configured. container on the `172.17.0.0/16` subnet. This will result in poor transfer rates
if local device addresses are not manually configured.
To allow local discovery, the docker host network can be used instead: It is therefore advisable to use the [host network mode](https://docs.docker.com/network/host/) instead:
**Docker cli**
``` ```
$ docker pull syncthing/syncthing $ docker pull syncthing/syncthing
$ docker run --network=host \ $ docker run --network=host \
@ -59,6 +61,24 @@ $ docker run --network=host \
syncthing/syncthing:latest syncthing/syncthing:latest
``` ```
**Docker compose**
```yml
---
version: "3"
services:
syncthing:
image: syncthing/syncthing
container_name: syncthing
hostname: my-syncthing
environment:
- PUID=1000
- PGID=1000
volumes:
- /wherever/st-sync:/var/syncthing
network_mode: host
restart: unless-stopped
```
Be aware that syncthing alone is now in control of what interfaces and ports it Be aware that syncthing alone is now in control of what interfaces and ports it
listens on. You can edit the syncthing configuration to change the defaults if listens on. You can edit the syncthing configuration to change the defaults if
there are conflicts. there are conflicts.