Change config directory docker compose error

I’ve successfully installed and configured ST with the docker-compose.yml file from README-Docker.md and wanted to change the config directory path in order to mount a separate volume for it on another folder of my host (don’t like that the config directory resides where I sync and work with files).

This post is very similar to mine and so I tried to add the following to my configuration: command: --config /etc/config --data /var/syncthing.

This, when rebuilding the container (docker container up --build), generates the following error:

...
Attaching to syncthing
syncthing  | 2024/03/29 22:19:08 WARNING: Command line options: --home must not be used together with --config and --data
syncthing exited with code 0

This apparently prevents the container from starting; if the command directive is removed the container starts just fine. This happens also when trying to override the startup command with entrypoint: /bin/entrypoint.sh /bin/syncthing

I think it’s a bug but I thought it would be better to ask here before opening an issue on GH.

Any workaround to override the config and data directories path when running on docker compose?

It’s probably being set in the DockerFile via

ENV STHOMEDIR=/var/syncthing/config

You can try to overwrite the environment variable STHOMEDIR with an empty string. But you prob need to tweak more to get this working properly:).

Setting STHOMEDIR= actually works, thanks!

Just needed to take care of folders permissions on the host, apparently docker creates the config folder at the new custom location with root privileges so I had to chown <user>:docker to get ST working, otherwise it fails trying to set its permissions on the internal directory.

1 Like