[GH-ISSUE #371] Can't mount /etc/onlyoffice as docker volume #189

Closed
opened 2026-02-26 10:30:46 +03:00 by kerem · 3 comments
Owner

Originally created by @ki9us on GitHub (Aug 2, 2021).
Original GitHub issue: https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/371

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

Request for documentation if I'm doing it wrong, or bug report if I'm doing it right and it's not working.

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

I don't know how to edit default.json. I tried mounting the container's /etc/onlyoffice and /etc/onlyoffice/documentserver directories in a docker volume, using this docker-compose.yml:

  onlyoffice:
    image: onlyoffice/documentserver:latest
    container_name: onlyoffice
    restart: always
    volumes:
      - "./onlyoffice/etc:/etc/onlyoffice/documentserver"
      - "./onlyoffice/www:/var/www/onlyoffice"
      - "./onlyoffice/log:/var/log/onlyoffice/documentserver"

Before starting, ensure that the mountpoint on the host doesn't exist.

$ ls ./onlyoffice/etc
ls: cannot access './onlyoffice/etc': No such file or directory
$ docker-compose up -d

The container "starts", but the directories are empty:

$ ls ./onlyoffice/etc
$ docker exec onlyoffice ls /etc/onlyoffice/documentserver
$ # crickets, tumbleweeds

So the container refuses to start because there's no config files. Not the two spaces between the host where a blank variable has been interpolated.

$ docker logs -n 0 onlyoffice
 Waiting for connection to the  host on port 
 nc: port number invalid: 
 Waiting for connection to the  host on port 
 nc: port number invalid: 
 Waiting for connection to the  host on port 
 nc: port number invalid: 
 Waiting for connection to the  host on port 
 nc: port number invalid: 
 Waiting for connection to the  host on port 
^C

What is the expected behavior?

In docker when you try to mount to a directory that doesn't exist on the host, like ./onlyoffice/etc, it is created and filled with the content of the image's version, like /etc/onlyoffice/documentserver.

This is what happens with log and www directories above, but not with etc:

$ ls ./onlyoffice/*
./onlyoffice/etc:

./onlyoffice/log:
converter  docservice  metrics  spellchecker

./onlyoffice/www:
Data

I can start the container by commenting out the etc volume mount line in the docker-compose.yml. Then the container starts without any problem but I can't modify default.json except in the container, which won't persist reboots.

Did this work in previous versions of DocumentServer?

I don't know.

DocumentServer Docker tag:

$ docker ps | grep onlyoffice | awk '{print $2}'
onlyoffice/documentserver:latest

Host Operating System:

uname -a; lsb_release -a
Linux ksn 5.10.0-8-amd64 #1 SMP Debian 5.10.46-1 (2021-06-24) x86_64 GNU/Linux
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye
Originally created by @ki9us on GitHub (Aug 2, 2021). Original GitHub issue: https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/371 ## Do you want to request a *feature* or report a *bug*? **Request for documentation** if I'm doing it wrong, or **bug report** if I'm doing it right and it's not working. ## What is the current behavior? If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. I don't know how to edit `default.json`. I tried mounting the container's `/etc/onlyoffice` and `/etc/onlyoffice/documentserver` directories in a docker volume, using this docker-compose.yml: ```yml onlyoffice: image: onlyoffice/documentserver:latest container_name: onlyoffice restart: always volumes: - "./onlyoffice/etc:/etc/onlyoffice/documentserver" - "./onlyoffice/www:/var/www/onlyoffice" - "./onlyoffice/log:/var/log/onlyoffice/documentserver" ``` Before starting, ensure that the mountpoint on the host doesn't exist. ```sh $ ls ./onlyoffice/etc ls: cannot access './onlyoffice/etc': No such file or directory $ docker-compose up -d ``` The container "starts", but the directories are empty: ```sh $ ls ./onlyoffice/etc $ docker exec onlyoffice ls /etc/onlyoffice/documentserver $ # crickets, tumbleweeds ``` So the container refuses to start because there's no config files. Not the two spaces between `the host` where a blank variable has been interpolated. ```sh $ docker logs -n 0 onlyoffice Waiting for connection to the host on port nc: port number invalid: Waiting for connection to the host on port nc: port number invalid: Waiting for connection to the host on port nc: port number invalid: Waiting for connection to the host on port nc: port number invalid: Waiting for connection to the host on port ^C ``` ## What is the expected behavior? In docker when you try to mount to a directory that doesn't exist on the host, like `./onlyoffice/etc`, it is created and filled with the content of the image's version, like `/etc/onlyoffice/documentserver`. This is what happens with `log` and `www` directories above, but not with `etc`: ```sh $ ls ./onlyoffice/* ./onlyoffice/etc: ./onlyoffice/log: converter docservice metrics spellchecker ./onlyoffice/www: Data ``` I can start the container by commenting out the etc volume mount line in the docker-compose.yml. Then the container starts without any problem but I can't modify `default.json` except _in_ the container, which won't persist reboots. ## Did this work in previous versions of DocumentServer? I don't know. ## DocumentServer Docker tag: ```sh $ docker ps | grep onlyoffice | awk '{print $2}' onlyoffice/documentserver:latest ``` ## Host Operating System: ```sh uname -a; lsb_release -a Linux ksn 5.10.0-8-amd64 #1 SMP Debian 5.10.46-1 (2021-06-24) x86_64 GNU/Linux Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye ```
kerem closed this issue 2026-02-26 10:30:46 +03:00
Author
Owner

@ShockwaveNN commented on GitHub (Aug 3, 2021):

Hi, thanks for this detailed report

First of all
You should not mount default.json from host - this is file with default configs, and for example if we add some new required options to this file, update Docker image - if you mount old version of this file - you get DocumentServer startup error with this option missing in file

There is two alternative option

  1. Mount local.json instead, and not all folder ./onlyoffice/etc - but single file (docker and docker-compose allow mount not only directory, but single file also)

Something like this:

    volumes:
      - "./onlyoffice/etc/locac.json:/etc/onlyoffice/documentserver/local.json"
      - "./onlyoffice/www:/var/www/onlyoffice"
      - "./onlyoffice/log:/var/log/onlyoffice/documentserver"
  1. Add startup options via editing config on runtime
    Something like this should be added to run command, not exactly, but to get idea
JSON_EXE=/var/www/onlyoffice/documentserver/npm/json
docker exec -it DocumentServer $JSON_EXE -f /etc/onlyoffice/documentserver/local.json -I -e 'this.services.CoAuthoring.autoAssembly.enable=true'
<!-- gh-comment-id:891606820 --> @ShockwaveNN commented on GitHub (Aug 3, 2021): Hi, thanks for this detailed report First of all You should not mount `default.json` from host - this is file with default configs, and for example if we add some new required options to this file, update Docker image - if you mount old version of this file - you get DocumentServer startup error with this option missing in file There is two alternative option 1. Mount `local.json` instead, and not all folder `./onlyoffice/etc` - but single file (docker and docker-compose allow mount not only directory, but single file also) Something like this: ``` volumes: - "./onlyoffice/etc/locac.json:/etc/onlyoffice/documentserver/local.json" - "./onlyoffice/www:/var/www/onlyoffice" - "./onlyoffice/log:/var/log/onlyoffice/documentserver" ``` 2. Add startup options via editing config on runtime Something like this should be added to run command, not exactly, but to get idea ``` JSON_EXE=/var/www/onlyoffice/documentserver/npm/json docker exec -it DocumentServer $JSON_EXE -f /etc/onlyoffice/documentserver/local.json -I -e 'this.services.CoAuthoring.autoAssembly.enable=true' ```
Author
Owner

@ki9us commented on GitHub (Aug 4, 2021):

1 worked for me, but I did have to create a local local.json and populate it with the version created by the container.

{
  "services": {
    "CoAuthoring": {
      "sql": {
        "type": "postgres",
        "dbHost": "localhost",
        "dbPort": "5432",
        "dbName": "onlyoffice",
        "dbUser": "onlyoffice",
        "dbPass": "onlyoffice"
      },
      "token": {
        "enable": {
          "request": {
            "inbox": false,
            "outbox": false
          },
          "browser": false
        },
        "inbox": {
          "header": "Authorization"
        },
        "outbox": {
          "header": "Authorization"
        }
      },
      "secret": {
        "inbox": {
          "string": "secret"
        },
        "outbox": {
          "string": "secret"
        },
        "session": {
          "string": "secret"
        }
      }
    }
  },
  "rabbitmq": {
    "url": "amqp://guest:guest@localhost"

By the way, should I change the secret strings?

<!-- gh-comment-id:892265655 --> @ki9us commented on GitHub (Aug 4, 2021): 1 worked for me, but I did have to create a local `local.json` and populate it with the version created by the container. ```json { "services": { "CoAuthoring": { "sql": { "type": "postgres", "dbHost": "localhost", "dbPort": "5432", "dbName": "onlyoffice", "dbUser": "onlyoffice", "dbPass": "onlyoffice" }, "token": { "enable": { "request": { "inbox": false, "outbox": false }, "browser": false }, "inbox": { "header": "Authorization" }, "outbox": { "header": "Authorization" } }, "secret": { "inbox": { "string": "secret" }, "outbox": { "string": "secret" }, "session": { "string": "secret" } } } }, "rabbitmq": { "url": "amqp://guest:guest@localhost" ``` By the way, should I change the secret strings?
Author
Owner

@ShockwaveNN commented on GitHub (Aug 4, 2021):

By the way, should I change the secret strings?

Yes, especially if this server public

But if your only edit in local.json is related to JWT - its better to use Docker Env JWT_ENABLED, JWT_SECRET and others, depending on your setup and integration type

<!-- gh-comment-id:892427834 --> @ShockwaveNN commented on GitHub (Aug 4, 2021): > By the way, should I change the secret strings? Yes, especially if this server public But if your only edit in `local.json` is related to JWT - its better to use Docker Env `JWT_ENABLED`, `JWT_SECRET` and others, depending on your setup and integration type
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#189
No description provided.