How to add Fonts to Windows Docker container/image?

荒凉一梦 提交于 2020-02-06 02:41:31

问题


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

回答1:


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


来源:https://stackoverflow.com/questions/59779075/how-to-add-fonts-to-windows-docker-container-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!