syncthing cli config options (docker w/proxy)

Doing some automations. Would really like to use cli to configure / get vals. Can’t get around this.

syncthing is containerized with env:

    environment:
  - all_proxy=socks5://myproxy:1080
  - ALL_PROXY_NO_FALLBACK=1

Even w/no_proxy still no connect:

root@gluetun:/config# syncthing cli config  options --home=/config
syncthing: error: Get "http://127.0.0.1:40871/rest/system/config": dial tcp 127.0.0.1:40871: connect: connection refused

root@gluetun:/config# export no_proxy=localhost,127.0.0.1
root@gluetun:/config# export NO_PROXY=$no_proxy

root@gluetun:/config# syncthing cli config  options --home=/config
syncthing: error: Get "http://127.0.0.1:40871/rest/system/config": dial tcp 127.0.0.1:40871: connect: connection refused

syncthing cli config  options --home=/config --gui-address=localhost:8384
syncthing: error: Get "http://127.0.0.1:40871/rest/system/config": dial tcp 127.0.0.1:40871: connect: connection refused

Are you running cli in the same container as syncthing is running?

Also, the port looks wonky. We usually use 8384, seems that gui address is ignored once you pass a config directory.

Hello and thanks!

I typically have this running with network_mode: container:gluetun, all_proxy, ALL_PROXY_NO_FALLBACK

I’ve disabled those so with syncthing running independently:

root@ad6b74d32f42:/# syncthing cli config  options --gui-address=localhost:8384
syncthing: error: Get "http://127.0.0.1:40871/rest/system/config": dial tcp 127.0.0.1:40871: connect: connection refused

root@ad6b74d32f42:/# netstat -na | grep 8384
tcp        0      0 :::8384                 :::*                    LISTEN

root@ad6b74d32f42:/# syncthing cli config  options
syncthing: error: Get "http://127.0.0.1:40871/rest/system/config": dial tcp 127.0.0.1:40871: connect: connection refused

root@ad6b74d32f42:/# syncthing cli config  options  --home=/config
syncthing: error: Get "http://127.0.0.1:40871/rest/system/config": dial tcp 127.0.0.1:40871: connect: connection refused

That listen for 8384 seems to be ipv6 only (?) or am I misreading?

And I can’t figure out where it’s getting 40871

Its most likely getting the unusual port from the config which you are telling it to read.

Also check for env vars starting with ST

Its hard to say if it’s bound to v6 only. You can run netstat with -4 to return v4 only perhaps (from memory, not certain).

I never found root cause of this issue but suspect it has something to do with the linuxserver.io image.

For various reasons we’ve been using the syncthing/syncthing image instead.

In fact, if I do this:

docker run -d \
  --name=syncthing \
  --hostname=syncthing `#optional` \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Etc/UTC \
  -p 8384:8384 \
  -p 22000:22000/tcp \
  -p 22000:22000/udp \
  -p 21027:21027/udp \
  -v ./config:/config \
  --restart unless-stopped \
  lscr.io/linuxserver/syncthing:latest
# ls -ld config
drwx------ 4 1000 1000 4096 May  7 13:34 config//
# ls config
Sync/  cert.pem  config.xml  config.xml.v0  https-cert.pem  https-key.pem  index-v0.14.0.db/  key.pem
# docker exec -it syncthing syncthing cli show system
syncthing: error: reading device ID: open /config/.local/state/syncthing/cert.pem: no such file or directory