6

I would like to create a Docker image using Alpine Linux and LibreOffice to render PDF documents. The LibreOffice source documents are using Microsofts Times New Roman font.

How can I install Microsoft fonts using apk on Alpine Linux? Is there an equivalent packet to Ubuntus apt install ttf-mscorefonts-installer?

Update 1:

Meanwhile I have found a package called [msttcorefonts-installer][1] that seems to provide what I am looking for. When I try to install it on Alpine Linux 3.7 using apk add msttcorefonts-installer-3.6-r2 I get the following error:

ERROR: unsatisfiable constraints:
  msttcorefonts-installer-3.6-r2 (missing):
    required by: world[msttcorefonts-installer-3.6-r2]
  • Did you check the Alpine packages? – Mikael Kjær Apr 17 '18 at 6:58
  • I have updated my question providing the latest findings of my research. – saw303 Apr 17 '18 at 7:29
  • You don't need the version number. apk --no-cache add msttcorefonts-installer works. – Mikael Kjær Apr 17 '18 at 7:52
16

As you found yourself the package is called msstcorefonts-installer in Alpine 3.7.

After installing that you get a warning:

  • With root permissions run "update-ms-fonts" and once completed
  • run "fc-cache -f" in order to update the font cache

Here is a working Dockerfile example:

FROM alpine:3.7
RUN apk --no-cache add msttcorefonts-installer fontconfig && \
    update-ms-fonts && \
    fc-cache -f

The fontconfig package is required for fc-cache to be installed. I'm not sure if it's strictly necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.