[GH-ISSUE #556] local.json regenerates after every restart #267

Closed
opened 2026-02-26 10:31:27 +03:00 by kerem · 7 comments
Owner

Originally created by @iam-angel-val on GitHub (Dec 16, 2022).
Original GitHub issue: https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/556

Do you want to request a feature or report a bug?
Report a bug

What is the current behavior?
Every time I restart my docker-based document server, the /etc/onlyoffice/documentserver/local.json file is regenerated, setting everything to their default values and randomly generating a secret key.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

  1. Install the onlyoffice docker document server via the official guide
  2. Docker exec bash into the container, and edit /etc/onlyoffice/documentserver/local.json
  3. Save and exit container, then docker restart it
  4. Go back into container and edit local.json again
  5. See that everything is back to before you edited it, and a new secret key has been generated

What is the expected behavior?
The configuration file stays the same before and after the restart

Did this work in previous versions of DocumentServer?
This is the first time I've used it.

DocumentServer Docker tag:
latest

Host Operating System:
Ubuntu Server 22.04.1 LTS in a qemu-kvm VM

Originally created by @iam-angel-val on GitHub (Dec 16, 2022). Original GitHub issue: https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/556 **Do you want to request a *feature* or report a *bug*?** Report a bug **What is the current behavior?** Every time I restart my docker-based document server, the /etc/onlyoffice/documentserver/local.json file is regenerated, setting everything to their default values and randomly generating a secret key. **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.** 1. Install the onlyoffice docker document server via the official guide 2. Docker exec bash into the container, and edit /etc/onlyoffice/documentserver/local.json 3. Save and exit container, then docker restart it 4. Go back into container and edit local.json again 5. See that everything is back to before you edited it, and a new secret key has been generated **What is the expected behavior?** The configuration file stays the same before and after the restart **Did this work in previous versions of DocumentServer?** This is the first time I've used it. **DocumentServer Docker tag:** latest **Host Operating System:** Ubuntu Server 22.04.1 LTS in a qemu-kvm VM
kerem 2026-02-26 10:31:27 +03:00
  • closed this issue
  • added the
    wontfix
    label
Author
Owner

@cliffjao commented on GitHub (Dec 31, 2022):

I'm running into this issue as well. And if I add a docker volume for /etc/onlyoffice, it fails to start properly.

<!-- gh-comment-id:1368266666 --> @cliffjao commented on GitHub (Dec 31, 2022): I'm running into this issue as well. And if I add a docker volume for /etc/onlyoffice, it fails to start properly.
Author
Owner

@spiffyguy commented on GitHub (Jan 9, 2023):

Looks like you can set an environment variable called JWT_SECRET to statically set the secret.

I am using portainer so I have a GUI for this docker container, I chose the "Env" tab and added it before I deployed:

image

When I restart, the "secret" in "local.json" is set to this environment variable value every time.

<!-- gh-comment-id:1375796480 --> @spiffyguy commented on GitHub (Jan 9, 2023): Looks like you can set an environment variable called `JWT_SECRET` to statically set the secret. I am using portainer so I have a GUI for this docker container, I chose the "Env" tab and added it before I deployed: ![image](https://user-images.githubusercontent.com/4824923/211344689-285181e9-bc51-4e41-9078-9bdddc32fa44.png) When I restart, the "secret" in "local.json" is set to this environment variable value every time.
Author
Owner

@iam-angel-val commented on GitHub (Jan 9, 2023):

Hmm okay, how exactly did you find out about this? I couldn't find it in any of the docs that I read, and it seems like a pretty fundamental problem that a lot of people would have. Tbh they should put this info on the same screen where they tell you that you need to set the key (the site that comes up when you enter the server url into a browser)

<!-- gh-comment-id:1375801466 --> @iam-angel-val commented on GitHub (Jan 9, 2023): Hmm okay, how exactly did you find out about this? I couldn't find it in any of the docs that I read, and it seems like a pretty fundamental problem that a lot of people would have. Tbh they should put this info on the same screen where they tell you that you need to set the key (the site that comes up when you enter the server url into a browser)
Author
Owner

@spiffyguy commented on GitHub (Jan 9, 2023):

It's not super clear but on this repo in the README, under the "Available Configuration Parameters" (https://github.com/ONLYOFFICE/Docker-DocumentServer#available-configuration-parameters) it says
JWT_SECRET: Defines the secret key to validate the JSON Web Token in the request to the ONLYOFFICE Document Server. Defaults to random value.

I googled "JWT_SECRET" and found some examples of people using it to set the secret to what they want.

According to the README it says: Defaults to random value. so you HAVE to set it for docker if you want to keep it the same after every restart...

Again not super clear because for a normal (not docker, bare-metal) install... it obviously would not be "rebuilt" after every restart. There should be a clear "For Docker users... be sure to set JWT_SECRET or else it will reset to a random string after every restart."

<!-- gh-comment-id:1375809854 --> @spiffyguy commented on GitHub (Jan 9, 2023): It's not super clear but on this repo in the README, under the "Available Configuration Parameters" (https://github.com/ONLYOFFICE/Docker-DocumentServer#available-configuration-parameters) it says `JWT_SECRET: Defines the secret key to validate the JSON Web Token in the request to the ONLYOFFICE Document Server. Defaults to random value.` I googled "JWT_SECRET" and found some examples of people using it to set the secret to what they want. According to the README it says: `Defaults to random value.` so you HAVE to set it for docker if you want to keep it the same after every restart... Again not super clear because for a normal (not docker, bare-metal) install... it obviously would not be "rebuilt" after every restart. There should be a clear "For Docker users... be sure to set `JWT_SECRET` or else it will reset to a random string after every restart."
Author
Owner

@spiffyguy commented on GitHub (Jan 9, 2023):

https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/661

Here someone else has the same issue but they asked on the MAIN "DocumentServer" repo... the reply mentions JWT_KEY but I can confirm it should be JWT_SECRET for this.

<!-- gh-comment-id:1375827117 --> @spiffyguy commented on GitHub (Jan 9, 2023): https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/661 Here someone else has the same issue but they asked on the MAIN "DocumentServer" repo... the reply mentions ~~`JWT_KEY`~~ but I can confirm it should be `JWT_SECRET` for this.
Author
Owner

@igwyd commented on GitHub (Nov 6, 2024):

Hello @iam-angel-val, sorry for the late reply. @spiffyguy are right, just use vailable-configuration-parameters.

<!-- gh-comment-id:2459905064 --> @igwyd commented on GitHub (Nov 6, 2024): Hello @iam-angel-val, sorry for the late reply. @spiffyguy are right, just use [vailable-configuration-parameters](https://github.com/ONLYOFFICE/Docker-DocumentServer#available-configuration-parameters).
Author
Owner

@Rita-Bubnova commented on GitHub (Nov 7, 2024):

I close this issue. Feel free to comment or reopen it if you got further questions.

<!-- gh-comment-id:2461563040 --> @Rita-Bubnova commented on GitHub (Nov 7, 2024): I close this issue. Feel free to comment or reopen it if you got further questions.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Docker-DocumentServer-ONLYOFFICE#267
No description provided.