Docker Compose File Example Needed

Hello wonderful people,

I am trying to install Collabora Code via Docker Compose. I wish to bring coolwsd.xml out to the host directory for easy editing. However, I am unable to write a proper docker compose file for the said purpose. Here are few examples that I am trying with no luck,

Example 1

trying to mount as single file.

services:

    collabora:
        image: collabora/code
        container_name: collabora
        ports:
            - "9980:9980"
        restart: unless-stopped
	    volumes:
	        - ./coolwsd.xml:/etc/coolwsd/coolwsd.xml
        environment:
            - domain=office.mydomain.online
            - username=User
            - password=Password
            - dictionaries=en_US
            - TZ=Asia/Kolkata

I have tried to start the container with or without any pre existing blank coolwsd.xml file in the directory. But no luck in both cases.

Example 2

Trying to mount the entire directory,

services:

    collabora:
        image: collabora/code
        container_name: collabora
        ports:
            - "9980:9980"
        restart: unless-stopped
	    volumes:
	        - ./config:/etc/coolwsd/
        environment:
            - domain=office.mydomain.online
            - username=Username
            - password=Password
            - dictionaries=en_US
            - TZ=Asia/Kolkata

Its not working in both cases…

Service is deploying without any issue if I just remove the “volumes” parameters out of this example. But in that case, I am finding it very hard to go inside the container for any editing.

It would be helpful for me if someone can help me write a proper docker compose file

Thanks.

Hello @NaXal Welcome to collabora online forums.

You can mount /etc/coolwsd as a volume and then just modify it from the host machine. You’ll probably need to do this before starting the container:

Here I’m binding /var/container/collabora/etc/coolwsd/ on the host to /etc/coolwsd/ on the container in the yaml format used by docker compose:

services:
collabora:
image: collabora/code
volumes:
- /var/container/collabora/etc/coolwsd/:/etc/coolwsd/

P.S. If you’re using the Docker CODE image you can also specify parameters/ command line options via Docker environment variables:

https://sdk.collaboraonline.com/docs/installation/Configuration.html

Thanks,
Darshan

1 Like

Hello,

Thanks for your quick reply.

I have tried to write the file as instructed. Here is the example,

services:

    collabora:
        image: collabora/code
        container_name: collabora
        ports:
            - "9980:9980"
        restart: unless-stopped
        volumes:
            - /var/container/collabora/etc/coolwsd/:/etc/coolwsd/
        environment:
            - domain=office.mydomain.online
            - username=xxxx
            - password=xxxxx
            - dictionaries=en_US
            - TZ=Asia/Kolkata

But I have having same issue as previous with my other attempts. It is not working. Container is stuck in a restarting loop.

root@vm-office:/home/naxal/office# docker ps
CONTAINER ID   IMAGE            COMMAND                  CREATED              STATUS                            PORTS     NAMES
85d1214382b0   collabora/code   "/start-collabora-on…"   About a minute ago   Restarting (139) 50 seconds ago             collabora
root@vm-office:/home/naxal/office#

Here are the logs.

root@vm-office:/home/naxal/office# docker logs --since=1h 85d1214382b0
Certificate request self-signature ok
subject=C = DE, ST = BW, L = Stuttgart, O = Dummy Authority, CN = localhost
mv: cannot create regular file '/etc/coolwsd/key.pem': Permission denied
mv: cannot create regular file '/etc/coolwsd/cert.pem': Permission denied
mv: cannot create regular file '/etc/coolwsd/ca-chain.cert.pem': Permission denied
Failed to initialize COOLWSD: File not found: /etc/coolwsd/coolwsd.xml
-00001 2024-09-17 12:18:29.531246 +0530 [ coolwsd ] FTL  Failed to initialize COOLWSD: File not found: /etc/coolwsd/coolwsd.xml| wsd/COOLWSD.hpp:530
File not found: /etc/coolwsd/coolwsd.xml
-00001 2024-09-17 12:18:29.531343 +0530 [ coolwsd ] SIG   Fatal signal received: SIGABRT code: 18446744073709551610 for address: 0x6400000001
Recent activity:

Backtrace 1 - wsd 24.04.7.2 d5ebff5:
/usr/bin/coolwsd(_ZN7SigUtil13dumpBacktraceEv+0x73)[0x7ba7b3]
/usr/bin/coolwsd[0x7babd5]
/lib/x86_64-linux-gnu/libc.so.6(+0x3c050)[0x7450dd965050]
/lib/x86_64-linux-gnu/libc.so.6(+0x8ae3c)[0x7450dd9b3e3c]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x12)[0x7450dd964fb2]
/lib/x86_64-linux-gnu/libc.so.6(abort+0xd3)[0x7450dd94f472]
/usr/bin/coolwsd[0x5adb79]
/lib/x86_64-linux-gnu/libc.so.6(+0x3c050)[0x7450dd965050]
/usr/bin/coolwsd(_ZN7COOLWSDD2Ev+0x26)[0x67c896]
/usr/bin/coolwsd(main+0xef)[0x5be97f]
/lib/x86_64-linux-gnu/libc.so.6(+0x2724a)[0x7450dd95024a]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85)[0x7450dd950305]
/usr/bin/coolwsd[0x5c5042]
Certificate request self-signature ok
subject=C = DE, ST = BW, L = Stuttgart, O = Dummy Authority, CN = localhost
mv: cannot create regular file '/etc/coolwsd/key.pem': Permission denied
mv: cannot create regular file '/etc/coolwsd/cert.pem': Permission denied
mv: cannot create regular file '/etc/coolwsd/ca-chain.cert.pem': Permission denied
Failed to initialize COOLWSD: File not found: /etc/coolwsd/coolwsd.xml
-00001 2024-09-17 12:18:32.790548 +0530 [ coolwsd ] FTL  Failed to initialize COOLWSD: File not found: /etc/coolwsd/coolwsd.xml| wsd/COOLWSD.hpp:530
File not found: /etc/coolwsd/coolwsd.xml
-00001 2024-09-17 12:18:32.790604 +0530 [ coolwsd ] SIG   Fatal signal received: SIGABRT code: 18446744073709551610 for address: 0x6400000001
Recent activity:

Just to confirm, I am running the container up command as root user.

Thanks.

It looks like there are two main issues based on the logs:

  1. Permission Denied Errors: The container is failing to create necessary files like key.pem, cert.pem, and ca-chain.cert.pem in /etc/coolwsd/. This is likely a permissions issue on the mounted volume, as Docker containers can sometimes have issues with file ownership and permissions, especially when dealing with root-owned directories on the host.

  2. Missing coolwsd.xml File: The error Failed to initialize COOLWSD: File not found: /etc/coolwsd/coolwsd.xml suggests that the container expects a valid coolwsd.xml to exist in the mounted directory, but it cannot find it or lacks permission to access it.

Solution Steps:

Step 1: Fix Permissions on the Mounted Volume

Since you’re mounting /var/container/collabora/etc/coolwsd/ to /etc/coolwsd/ in the container, the container needs read and write permissions for that directory. To ensure the container has the correct permissions, you can change the owner of the directory to match the container’s user or set appropriate permissions.

Run the following command to adjust the permissions of the directory:

sudo chown -R 101:101 /var/container/collabora/etc/coolwsd/

This command sets the ownership of the directory to user 101, which is the UID typically used by the Collabora CODE container. You may also want to set write permissions to ensure the container can create necessary files:

sudo chmod -R 755 /var/container/collabora/etc/coolwsd/

Step 2: Ensure coolwsd.xml Exists

The error about the missing coolwsd.xml file indicates the file might be missing in your mounted directory. You can copy a default coolwsd.xml from the container to your host to get started.

To extract the default configuration:

  1. Start the container without the volume mount:
docker run --name temp-collabora --rm collabora/code
  1. Copy the coolwsd.xml file from the container:
docker cp temp-collabora:/etc/coolwsd/coolwsd.xml /var/container/collabora/etc/coolwsd/coolwsd.xml
  1. Stop the container:
docker stop temp-collabora

Now that you have a valid coolwsd.xml file in place, you can try running your docker-compose setup again.

Step 3: Update Docker Compose File

Your Docker Compose file looks good, but make sure the volumes section points to the correct location. Here’s the finalized version:

version: '3'

services:
  collabora:
    image: collabora/code
    container_name: collabora
    ports:
      - "9980:9980"
    restart: unless-stopped
    volumes:
      - /var/container/collabora/etc/coolwsd/:/etc/coolwsd/:rw
    environment:
      - domain=office.mydomain.online
      - username=xxxx
      - password=xxxxx
      - dictionaries=en_US
      - TZ=Asia/Kolkata

Step 4: Restart the Container

Once you’ve ensured the permissions are set and the coolwsd.xml file exists, you can restart the container:

docker-compose up -d

Debugging

  • If the container still fails to start, check the logs again for any further permission issues or errors:
docker logs collabora
  • You can also enter the container and inspect the files to ensure everything is in place:
docker exec -it collabora /bin/bash

From there, you can check the contents of /etc/coolwsd/ to verify that the mounted volume and files are accessible.

Let me know how this works for you!

1 Like

Hello,

Thank you for the Indepth and detailed explanation and guidance.

I am able to solve the issue and get the service started.

Thanks.

1 Like

Awesome @NaXal i am happy that it helped to solve the issue :slight_smile:

1 Like