如何将字体添加到Windows Docker容器/图像? [英] How to add Fonts to Windows Docker container/image?
问题描述
我有一个基于.NET Framework v4.8构建的控制台应用程序。我正在尝试使用docker映像在Azure容器实例(ACI)中运行它。我已经在本地创建了一个泊坞窗映像并将其推送到ACI,并且该映像运行成功。
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.
现在我面临一个问题。此应用程序发送带有RDLC报告的电子邮件。但是我在邮件中收到的报告与我以前收到的报告(没有docker)具有不同的字体。我发现我正在使用的基本docker映像 mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019
没有加载字体。我需要在docker映像/容器中安装字体。我该怎么做?
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?
下面是我的Dockerfile命令:
Below is my Dockerfile commands:
FROM mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019 AS BASE
COPY . .
ENTRYPOINT BackgroundService.exe
推荐答案
一些调查发现了一种使用Dockerfile向容器添加字体的方法。我们需要在docker文件下面一行:
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 /
下面是更新的Dockerfile:
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
这篇关于如何将字体添加到Windows Docker容器/图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!