Setting up and configuring collabora/code Docker image

Collabora Online Development Edition (CODE) is available as a Docker image from Docker Hub. Currently the only supported platform is x86-64, and the image was mostly tested on Linux.

If you are not familiar with Docker concepts and basic commands, read the Docker Get Started document first.

Grab the Docker image like this:

$ docker pull collabora/code

Then start a new container, for example:

$ docker run -t -d -p 127.0.0.1:9980:9980 -e "domain=<your-dot-escaped-domain>" \
        -e "username=admin" -e "password=S3cRet" --restart always collabora/code

But first, please read further, about the configuration options.

How to configure collabora/code Docker image

There are multiple ways to put application configuration into Docker containers. Collabora Online has many configuration options and the Docker image comes with a built-in /etc/loolwsd/loolwsd.xml configuration file with the defaults.

1. Setting the application configuration dynamically via environment variables

After the -e command line option of docker run command you can define environment variables, that are passed to the container.

<your-dot-escaped-domain> is the WOPI host, i.e. your preferred File Sync and Share solution that implements WOPI protocol, for example share\\.example\\.com. You need double backslash in command line, because shell escapes the first, and the domain parameter takes a regular expression. Note: you can enable multiple domains by separating the domain names with | character.
The optional username and password parameters enable the admin console feature of CODE. You can access the admin console at https://<CODE-domain>/loleaflet/dist/admin/admin.html.
Other optional environment variables that you can pass to collabora/code are the following:

DONT_GEN_SSL_CERT When this environment variable is set (is not “”), then startup script will not generate a new SSL certificate signed by a dummy CA. It is useful, if you want to use your own SSL certificate for some reason.
cert_domain When this environment variable is set (is not “”), then startup script will generate a new SSL certificate signed by a dummy CA for this domain, not for localhost
server_name When this environment variable is set (is not “”), then its value will be used as server name in /etc/loolwsd/loolwsd.xml. Without this, CODE is not delivering a correct host for the websocket connection in case of a proxy in front of it.
dictionaries By default only limited set of spelling dictionaries and thesauri are configured for CODE, mainly for performance reasons. The default set of languages is the following: de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru. With the dictionaries environment variable you can change this list. The dictionaries environment variable should contain the space separated list of language codes (optionally followed by country code). In order to save resources, it makes sense to load only those dictionaries that are actually needed.
extra_params You can pass extra loolwsd command line parameter via this environment variable. For example, if you want to start loolwsd without SSL, when you test or develop, the syntax is: -e “extra_params=–o:ssl.enable=false”. To learn about all possible options, refer to the self-documented /etc/loolwsd/loolwsd.xml configuration file in the Docker image.

2. Use the configuration file directly

After starting the container, you can copy the configuration file out of the container, edit it, and copy it back to the container. The container will notice that the configuration file has changed, and the service will be restarted (don’t forget the --restart always option when you start the container with docker run).
1. Find out the name or hash of your container:

$ docker ps

The output would be something like this:

CONTAINER ID  IMAGE           COMMAND                  CREATED         STATUS        PORTS                      NAMES
a4633c28c690  collabora/code  "/bin/sh -c 'bash ..."   5 seconds ago   Up 4 seconds  127.0.0.1:9980->9980/tcp   romantic_meninsky

2. Copy out the config file:

$ docker cp romantic_meninsky:/etc/loolwsd/loolwsd.xml loolwsd.xml

3. Edit the config file with your favourite editor, then save and copy it back to the container:

$ docker cp loolwsd.xml romantic_meninsky:/etc/loolwsd/loolwsd.xml

Wait a few seconds for the the automatic restart.

Troubleshooting

After starting of the container, try:

$ curl -K https://localhost:9980

You should get the OK string, if everything is in order. Otherwise you can check the log with:

$ docker logs romantic_meninsky

(Of course instead of romantic_meninsky you’ll have something different as the output of docker ps.)

Misc

If you need customizations, for example additional fonts, you can build the docker image yourself. See the source on GitHub. Add font packages to install-libreoffice.sh script, then build a custom image.

Known problems: