18

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]
saw303
  • 283
  • 1
  • 2
  • 7

1 Answers1

49

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

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:latest
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.

Mikael Kjær
  • 961
  • 8
  • 9