Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Fonts to Windows Docker container/image?

Tags:

I have a console application that is built on .NET Framework v4.8. I am trying to run it in Azure Container Instances(ACI) using the docker image. I have created a docker image locally and pushed it to ACI and it is running successfully.

Now I am facing one issue. This application sends an email with RDLC reports. But the reports I am getting in the mail have different fonts than the report I am getting previously(without docker). I found that the base docker image mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019 I am using does not have fonts loaded with it. I need to install fonts in my docker image/container. How can I do this?

Below is my Dockerfile commands:

FROM mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019  AS BASE
COPY . .
ENTRYPOINT BackgroundService.exe
like image 558
Abhishek Prajapati Avatar asked Jan 16 '20 23:01

Abhishek Prajapati


People also ask

How do I install TTF fonts in Windows 10?

If the font files are zipped, unzip them by right-clicking the .zip folder and then clicking Extract. Now you'll see the available TrueType and OpenType font files: Right-click the fonts you want, and click Install.

Can you Containerize a Windows application?

You can run any application in Docker as long as it can be installed and executed unattended, and the base operating system supports the app. Windows Server Core runs in Docker which means you can run pretty much any server or console application in Docker.

How do I install fonts in Windows XP?

Windows XPFrom the Start menu, select the Control Panel and double-click on the Fonts folder icon. Here, select 'Install New Font' from the File menu and navigate to the folder containing the fonts. Once there, the fonts appear in the 'List of Fonts' field.


1 Answers

I have done some investigation and found a way to add fonts to the container using Dockerfile. We need to below line docker file:

COPY arial*.ttf c:/windows/fonts/

Below is the updated Dockerfile:

# app image
FROM mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019  AS BASE
COPY arial*.ttf c:/windows/fonts/
COPY . .
ENTRYPOINT BackgroundService.exe
like image 126
Abhishek Prajapati Avatar answered Oct 05 '22 11:10

Abhishek Prajapati