Adding fonts in server core 2019ltsc container image

docker alpine install fonts
docker install fonts
powershell install fonts
install fonts using intune
script to install fonts
powershell script to install fonts sccm
mdt install fonts
powershell install fonts overwrite

We have an app (GrapeCity ActiveReports) that generates pdf reports running inside a container built on the following image: microsoft/dotnet-framework:4.7.2-sdk

This image is based on the 2019ltsc release, which is where the issue comes in. The pdf generating app is (attempting) to use the Arial font for these reports, but it is not being found in the Windows font directory.

Per this Microsoft blog (under the Container Improvements section), the 2019ltsc release stripped out all fonts except Arial, and it apparently prevents installing additional fonts.

Launching the un-modified SDK image interactively and browsing to C:\Windows\Fonts only shows the lucon.ttf font present and nothing else. We have also attempted the install fonts method outlined in this doc from Microsoft with no change. The font itself installs fine but the generating program fails to use it.

When run it returns the following exception:

System.InvalidOperationException: Cannot read the file for font: Arial

UPDATE: Recieved a reply from MS support, looks like there is probably no resolution at this time.

After a few days research, I haven’t got much progress about why the only font in based image is lucon.ttf, and seems there’s no published method to add additional fonts to windows server core 2019 image. Based on the situation, I have sent emails to windows server 2019 product team to consult this issue. However, please understand, due to permission limit, I couldn’t guarantee I can get feedback from Product Team. I will keep researching and monitor on the product team, if I get any progress, I will get back to you as soon as possible.

I was having same issue with "". Fonts got installed but the application failed to use them.

I installed the fonts by copying them to "c:\windows\fonts" folder and then calling "AddFontResource" and then also adding a registry entry to "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts". But no luck.

But then I ran the below command to see if the fonts were written to the registry:

Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts"

and noticed that the Arial font was missing. So I ran the below command through the shell:

Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" -name "Arial (TrueType)" -value "arial.ttf" -type STRING

And then re ran the below command to confirm the font Arial was not listed:

Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts"

After that when I ran my application it was able to load the Arial font.

Windows Server 2019 Core install fonts, You don't, only Arial in a Core container. Use the full windows base image. From the source blog post for build 17677: For Server Core  Use the full windows base image. From the source blog post for build 17677 : For Server Core containers, only the default font, Arial, is supported; no other fonts are supported, and no others can be installed.

I was able to get it to work in ltsc2019 by installing it like suggested before:

COPY calibri.ttf c:/windows/fonts/calibri.TTF
RUN powershell.exe -NoProfile -Command New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts' -Name 'Calibri (TrueType)' -PropertyType String -Value calibri.ttf

and then calling

[DllImport("gdi32.dll")] static extern int AddFontResource(string lpFilename);

before using the font. Calling AddFontResource while building the image didn't help.

As we start our application from powershell we call the LoadFonts.ps1 from C:\Users\ContainerAdministrator\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

RUN echo "C:\tools\LoadFonts.ps1" | Out-File -FilePath $profile


$fontCSharpCode = @'
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
namespace FontResource
    public class AddRemoveFonts
        static extern int AddFontResource(string lpFilename);
        public static int AddFont(string fontFilePath) {
                return AddFontResource(fontFilePath);
                return 0;

Add-Type $fontCSharpCode

foreach($font in $(gci C:\Windows\Fonts))
        Write-Output "Loading $($font.FullName)"
        [FontResource.AddRemoveFonts]::AddFont($font.FullName) | Out-Null

How to add Fonts in azure container? - Microsoft Q&A, I need to install fonts in my docker image/container. Specifies a Long Term Servicing Channel base Windows Server 2019 Core image, i.e.  Posted on stack overflow too. Cannot post link lol, search `docker-windows-2019-image-entrypoint-weird-path-issue ` in stack overflow I noticed there is a path handling

I wasn't able to get it working on a windows server core 2019 image either. I can confirm adding fonts does work in an 1803 image by using the following.

RUN powershell.exe -NoProfile -Command New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts' -Name 'MICRFONT (TrueType)' -PropertyType String -Value micrfont.ttf ;

Doing it through powershell via a shell object did not work.

T737801 - MVC Dashboard, The dashboards all work fine but when I try to export to a pdf/image it /​54366537/adding-fonts-in-server-core-2019ltsc-container-image. In our continued effort to improve Windows Server Core and reduce its image size, we made the following changes: - we converted non-critical font components into optional components (OC) in Windows Server Core editions, and then removed these OCs from Windows Server Core container images.

can confirm that the following worked for me

COPY arial.ttf c:\windows\fonts
COPY arialbd.ttf c:\windows\fonts

a unit test which previously failed due to lack of arial succeeded after.

additionally running this script inside the container showed arial

   [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
   (New-Object System.Drawing.Text.InstalledFontCollection).Families

Windows Server Core, The 1803-based Server Core container base image was a Semi-Annual Channel (SAC) release and received its final update on November 12th, 2019. For example, the Windows Server Core 2019 LTSC base image is 4.28 GB compared to the Windows Server Core 2016 LTSC image is 11GB, which equates to a decrease of 61 percent! You will benefit from faster startup time for your application because the container images will be smaller.

I found that installing and building an application that needed the fonts within the same RUN step in the dockerfile fixed the problem. I don't fully understand why, but when I had these steps in multiple layers, it did not detect the fonts.

Previous base images worked without needing to build the dockerfile using a single RUN such as 1709, 1803, but for the 2019ltc base image, the application was failing.

If others have issues such as this, I recommend attempting to run several steps under one RUN step in the dockerfile, when strange cases like this occur that do not seem to be application specific and are showing signs of a platform issue.

Windows server core container, Note that the SQL Server Image runs on Windows Server Core Container Image Apr 08, 2015 · Microsoft to add virtualized containers, Nano Server mode to now support Windows Containers based on: Windows Server Core 2019 LTSC; I can confirm adding fonts does work in an 1803 image by using the following. Windows Server vNext Semi-Annual Preview The Server Core Edition is available in English only, in ISO or VHDX format. The images are pre-keyed – no need to enter a key during setup. Symbols are available on the public symbol server – see Update on Microsoft’s Symbol Server blog post and Using the Microsoft Symbol Server.

microsoft/dotnet-framework-docker, except lucon.ttf have been eliminated in the server core 2019 base images. fonts are no longer included in the Windows Server Core 2019 base MichaelSimons added question area:external labels on Feb 13, 2019. Install base container images. Before working with Windows containers, a base image needs to be installed. Base images are available with either Windows Server Core or Nano Server as the container operating system. For detailed information on Docker container images, see Build your own images on

Windows Server versions and licensing, Anyone who has worked with the design or installation of a Windows Server in recent As you will see when we install Windows Server 2019 together, the default The nature of being headless makes Server Core faster and more efficient than way to run Nano Server right now is to run it as an image inside a container. Server Core for container host and image and Nano Server container image Device compatibility Unless otherwise communicated, the minimum hardware requirements to run the Semi-Annual Channel releases will be the same as the most recent Long-Term Servicing Channel release of Windows Server.

Report Layouts Not Rendering To PDF Properly, Running the exact same container image (tried versions from 14.1 up to the most is running server core 2019 (ltsc) 17763.737.1909062324 as the docker host. I add the fonts at the beginning of navstart.ps1 as I think that is the first script 

  • Hi, did you get any further with this problem? I've run into the same issue where I can get a successful build in 1709 but not ltsc2019. I've looked at the answers below but wondered if you managed to solve it a particular way or are still having issues?
  • @PatrickMagee I did not, we ended up switching to linux containers pretty shortly after. I did come across this in the Azure github repo, it specifies ltsc2019:…
  • Hi, did you manage to successfully install fonts on tag windowsservercore-ltsc2019?
  • Can confirm this DID NOT work for me in windowsservercore-ltsc2019