# Relay in docker keep the same id

**URL:** https://forum.syncthing.net/t/relay-in-docker-keep-the-same-id/21792
**Category:** Support
**Created:** [March 13, 2024, 4:33pm UTC](https://forum.syncthing.net/t/relay-in-docker-keep-the-same-id/21792 "2024-03-13T16:33:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Chucky2401](https://forum.syncthing.net/user_avatar/forum.syncthing.net/chucky2401/32/16065_2.png) [@Chucky2401](https://forum.syncthing.net/u/Chucky2401)
#### Post date: [March 13, 2024, 4:33pm UTC](https://forum.syncthing.net/t/relay-in-docker-keep-the-same-id/21792/1 "2024-03-13T16:33:33Z")

</div>

Hi, I created a docker image to have my private relay because of my company block Syncthing due to the classification by the firewall as a P2P.

Everything is working fine (I use Alpine and S6-overlay and I stream through NGinx Proxy Manager from an authorize port in my company). I use as reference the Dockerfile on the GitHub.

But I’m facing a long-term problem. That is, everytime I stop, delete and recreate the container (with docker compose), my relay ID change. It does not happened every day, but when this happen, I need to change my clients sync protocol listen address.

Actually, I have only the /var/strelaysrv, as the GitHub, but may be there is something else to mount to keep this ID? I don’t know, it’s just a theory.

---

<div class="post-metadata">

### Author: ![er-pa](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/e/90db22/32.png) [@er-pa](https://forum.syncthing.net/u/er-pa)
#### Post date: [March 13, 2024, 5:08pm UTC](https://forum.syncthing.net/t/relay-in-docker-keep-the-same-id/21792/2 "2024-03-13T17:08:36Z")

</div>

As far as I know the relay server uses keys to form an ID. The key-dir is per default `.`, the working directory `/var/strelaysrv` (inside the container). Either keys are created, if not present, or re-used. So if you map a volume `/dir/outside/docker/:/var/strelaysrv` then it should keep the same id.

---

<div class="post-metadata">

### Author: ![Chucky2401](https://forum.syncthing.net/user_avatar/forum.syncthing.net/chucky2401/32/16065_2.png) [@Chucky2401](https://forum.syncthing.net/u/Chucky2401)
#### Post date: [March 13, 2024, 7:33pm UTC](https://forum.syncthing.net/t/relay-in-docker-keep-the-same-id/21792/3 "2024-03-13T19:33:05Z")

</div>

My bad, I’m an idiot…

I had an error in my first build, that said it didn’t have permission to create **.pem file**. I added the parameter `-keys="/etc/strelaysrv"` as in the doc…

I add a `cd` to the **/var/strelaysrv** and run the relay several times, it works! I don’t know why I have to do a `cd`, as the directory is the home of the user, but maybe s6-overlay have to work like this.

Anyway, problem solved!

Thank you very much!

---

<div class="post-metadata">

### Author: ![er-pa](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/e/90db22/32.png) [@er-pa](https://forum.syncthing.net/u/er-pa)
#### Post date: [March 14, 2024, 12:21pm UTC](https://forum.syncthing.net/t/relay-in-docker-keep-the-same-id/21792/4 "2024-03-14T12:21:51Z")

</div>

Good to hear that it was resolved:)

---

<div class="post-metadata">

### Author: ![system](https://forum-uploads.syncthingcdn.net/original/2X/0/0b50e0a202b22ae6a67190759e8c868805b8ed9f.png) [@system](https://forum.syncthing.net/u/system)
#### Post date: [April 13, 2024, 12:22pm UTC](https://forum.syncthing.net/t/relay-in-docker-keep-the-same-id/21792/5 "2024-04-13T12:22:12Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
