Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ COPY --from=buildstage /tmp/sync/syncthing /usr/bin/
COPY root/ /

# ports and volumes
EXPOSE 8384 22000/tcp 22000/udp 21027/UDP
EXPOSE 8384 22000/tcp 22000/udp 21027/udp
VOLUME /config
2 changes: 1 addition & 1 deletion Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ COPY --from=buildstage /tmp/sync/syncthing /usr/bin/
COPY root/ /

# ports and volumes
EXPOSE 8384 22000/tcp 22000/udp 21027/UDP
EXPOSE 8384 22000/tcp 22000/udp 21027/udp
VOLUME /config
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ services:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- STGUIADDRESS="0.0.0.0:8384" # optional
- STGUIHOST=0.0.0.0 # optional
- STGUIPORT=8384 # optional
volumes:
- /path/to/syncthing/config:/config
- /path/to/data1:/data1
Expand All @@ -99,6 +102,9 @@ docker run -d \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Etc/UTC \
-e STGUIADDRESS="0.0.0.0:8384" `#optional` \
-e STGUIHOST=0.0.0.0 `#optional` \
-e STGUIPORT=8384 `#optional` \
-p 8384:8384 \
-p 22000:22000/tcp \
-p 22000:22000/udp \
Expand All @@ -121,9 +127,12 @@ Containers are configured using parameters passed at runtime (such as those abov
| `-p 22000:22000/tcp` | Listening port (TCP) |
| `-p 22000:22000/udp` | Listening port (UDP) |
| `-p 21027:21027/udp` | Protocol discovery |
| `-e PUID=1000` | for UserID - see below for explanation |
| `-e PGID=1000` | for GroupID - see below for explanation |
| `-e TZ=Etc/UTC` | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). |
| `-e PUID=1000` | For UserID - see below for explanation |
| `-e PGID=1000` | For GroupID - see below for explanation |
| `-e TZ=Etc/UTC` | Specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). |
| `-e STGUIADDRESS=0.0.0.0:8384` | Specify the application WebUI service listening address (default to `0.0.0.0:8384` if not overrided by env nor config.xml). Priority: env.STGUIADDRESS -> env.STGUIHOST/env.STGUIPORT -> config.xml -> default. |
| `-e STGUIHOST=0.0.0.0` | Specify the application WebUI service listening host (default to `0.0.0.0` if not overrided by env nor config.xml). Priority: env.STGUIADDRESS -> env.STGUIHOST/env.STGUIPORT -> config.xml -> default. |
| `-e STGUIPORT=8384` | Specify the application WebUI service listening port (default to `8384` if not overrided by env nor config.xml). Priority: env.STGUIADDRESS -> env.STGUIHOST/env.STGUIPORT -> config.xml -> default. |
| `-v /config` | Configuration files. |
| `-v /data1` | Data1 |
| `-v /data2` | Data2 |
Expand Down Expand Up @@ -289,7 +298,7 @@ docker run --rm --privileged lscr.io/linuxserver/qemu-static --reset
Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64`.

## Versions

* **06.12.25:** - [Feat] Allow override of GUI's listen address from Syncthing configuration file or environs
* **16.08.25:** - Rebase to Alpine 3.22.
* **13.08.25:** - Use double-dash long options for syncthing v2.0.0.
* **03.12.24:** - Rebase to Alpine 3.21.
Expand Down
5 changes: 5 additions & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ available_architectures:
- {arch: "{{ arch_arm64 }}", tag: "arm64v8-latest"}
# container parameters
common_param_env_vars_enabled: true #PGID, PUID, etc, you can set it to 'optional'
params_environs:
- { environ: "STGUIADDRESS", optional: true, desc: "Override default (0.0.0.0:8384) or STGUIHOST/STGUIPORT or confix.xml application Web UI listen address. Priority: env.STGUIADDRESS -> env.STGUIHOST/env.STGUIPORT -> config.xml -> default."}
- { environ: "STGUIHOST", optional: true, desc: "Override default (0.0.0.0) or config.xml application Web UI service listen host. Priority: env.STGUIADDRESS -> env.STGUIHOST/env.STGUIPORT -> config.xml -> default."}
- { environ: "STGUIPORT", optional: true, desc: "Override default (8384) or config.xml application Web UI service listen port. Priority: env.STGUIADDRESS -> env.STGUIHOST/env.STGUIPORT -> config.xml -> default."}
param_container_name: "{{ project_name }}"
param_usage_include_hostname: 'optional' #you can set it to 'optional'
param_hostname: "{{ project_name }}"
Expand Down Expand Up @@ -72,6 +76,7 @@ init_diagram: |
"syncthing:latest" <- Base Images
# changelog
changelogs:
- {date: "06.12.25:", desc: "[Feat] Allow override of GUI's listen address from Syncthing configuration file or environs"}
- {date: "16.08.25:", desc: "Rebase to Alpine 3.22."}
- {date: "13.08.25:", desc: "Use double-dash long options for syncthing v2.0.0."}
- {date: "03.12.24:", desc: "Rebase to Alpine 3.21."}
Expand Down
41 changes: 39 additions & 2 deletions root/etc/s6-overlay/s6-rc.d/svc-syncthing/run
Original file line number Diff line number Diff line change
@@ -1,8 +1,45 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

# Listen address lookup from:
# 1. Environ
# - 1. STGUIADDRESS
# - 2. STGUIHOST and/or STGUIPORT
# 2. Config (config.xml)
# 3. Default (0.0.0.0:8384)

cfg_address=$(
awk -v lookup=0 '
$1 == "<gui" { lookup=1 }
$1 == "</gui>" { lookup=0 }
lookup == 1 { print }
' /config/config.xml 2>/dev/null \
| grep address \
| sed 's|</\?address>||g; s|[[:space:]]||g'
)

cfg_host="${cfg_address%%:*}"
cfg_port="${cfg_address##*:}"

gui_address_host="${STGUIADDRESS%%:*}"
gui_address_port="${STGUIADDRESS##*:}"

gui_host="${STGUIHOST:-$cfg_host}"
gui_port="${STGUIPORT:-$cfg_port}"

gui_host="${gui_address_host:-$gui_host}"
gui_port="${gui_address_port:-$gui_port}"

gui_host="${gui_host:-0.0.0.0}"
gui_port="${gui_port:-8384}"

liveliness_target_host=$gui_host
if [[ "x${gui_host}" == "x0.0.0.0" ]]; then
liveliness_target_host="127.0.0.1"
fi

exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 8384" \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z ${liveliness_target_host} ${gui_port}" \
s6-setuidgid abc syncthing \
--home=/config --no-browser --no-restart \
--gui-address="0.0.0.0:8384"
--gui-address="${gui_host}:${gui_port}"