Collobora online and Docker => How to add new fonts?

Hi,

I would like to add fonts (TTFs) to Collabora online running as docker-container on nextcloud / Ubuntu 18.04. Via Internetresearch I found out that I have to put the TTFs into the folder /usr/local/share/fonts/truetype and to add an additional parameter to the docker-command:

–volume “/usr/local/share/fonts/truetype/:/opt/collaboraoffice6.0/share/fonts/truetype/local/:ro”

But this does not work for me. I also dont have a folder /opt/collaboraofice6.0.

Now I noticed that I have to install a special “CODE”-(developer)-edition of Collabora?

Any suggestions? A step-by-step solution would be nice.

Thanks
:slightly_smiling_face:

Hello Pasteo

As I understand it there are two ways to add Collabora to Nextcloud: as a package or as a Docker image. Both ways use the Collabora Online Developer Edition (CODE) unless you want to pay for the enterprise Collabora Office.

There are CODE packages available for several Linux distributions: https://www.collaboraoffice.com/code/linux-packages/
Using this you would probably be able to add your fonts via the directory you specified; however, this is something I haven’t tried.

I don’t believe you can add fonts to the Docker container; you have to tweak the original and then create your own Docker container. The instructions are here: https://www.collaboraoffice.com/code/docker/
Again, this is not something I have tried as it probably has to be tweaked every time there is a Collabora update.

Sorry this is not the full answer we would all want!

1 Like

this folder exist in the collabora container. not on your host. i hope you know the difference.

you may run a shell in your container and have a look.

docker exec -it <name-of-collabora-conatiner> /bin/sh

if there is no shell in this container try

docker exec <name-of-collabora-conatiner> ls /opt

then you have to look what’s in the folder /opt/collaboraoffice???/share/fonts/truetype/local

if there are already ttf files and you use the --volume parameter with docker run you have to make sure that these files are also in /usr/local/share/fonts/truetype. because you map the complete folder /usr/local/share/fonts/truetype from your host to the container folder /opt/collaboraoffice???/share/fonts/truetype/local.

you could also map single files from your host to the container. but if you want to add several file this can be a long list.

btw: i guess the version 6.0 is wrong. the collabora code image has the version 4.

Hi,

First of all you are right. I used the “exec”-command so I could mount the container and -yes- the folder with the fontfiles

/opt/collaboraoffice6.0/share/fonts/truetype

is now shown. The first step into the right direction, but not yet the solution :slightly_smiling_face: But the subfolder “truetype/local” in the container mentioned in the commandlet is missing. Shall I create this subfolder? I also dont know the meaning of “local/:ro” at the end of the commandlet. Is its syntax “local/:ro” correct?

So finally if I use the commandlet

docker run -t -d -p 127.0.0.1:9980:9980 -e ‘domain=nc\.sampledomain\.com’ -e “username=user” -e “password=secret” --restart always --cap-add MKNOD collabora/code --volume “/usr/local/share/fonts/truetype/:/opt/collaboraoffice6.0/share/fonts/truetype/local/:ro”

the error is still

Error response from daemon: OCI runtime create failed: container_linux.go:346:
starting container process caused “exec: “–volume”: executable file not found in $PATH”: unknown.

It would be nice if you could post the needed commandlets step-by-step for the solution.

Thanks
:slightly_smiling_face:

You may not put the --volume at the end. collabora/code, the name of the image should be at the end.

:ro means read only. A process in the container can’t write to this folder. It’s a security feature from docker.

And the folder path should be created. Including all sub folders.

Please be so kind and post the whole command as you would type it in.

thanks

:slightly_smiling_face:

docker run -t -d -p 127.0.0.1:9980:9980 -e 'domain=nc\.sampledomain\.com' -e "username=user" -e "password=secret" --restart always --cap-add MKNOD  --volume "/usr/local/share/fonts/truetype/:/opt/collaboraoffice6.0/share/fonts/truetype/local/:ro" --name collabora collabora/code 

btw: on my ubuntu 18.04 test machine ttf fonts were install to /usr/share/fonts/truetype. so you may want to change that in the docker run command as well.

Many Thanks, Reiner! It was the wrong syntax and your CMdlet is the solution I was looking for.

:grinning:

This command is not working :

docker run -t -d -p 127.0.0.1:9980:9980 -e ‘domain=nc\.sampledomain\.com’ --restart always --cap-add MKNOD --volume “/usr/local/share/fonts/truetype/:/root/collabora-fonts/:ro” collabora/code

Forlder /root/collabora-fonts/ not created in host, no sync

I have moved files with :
docker cp ./ubuntu thirsty_bardeen:/usr/share/fonts/truetype
docker restart collabora