如何将字体添加到 Windows Docker 容器/图像? [英] How to add Fonts to Windows Docker container/image?

查看:38
本文介绍了如何将字体添加到 Windows Docker 容器/图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

解决方案

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

这篇关于如何将字体添加到 Windows Docker 容器/图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆