如何在windowsservercore-1803的docker镜像中安装中文字体



我的PDF报告的docker图像中没有加载中文。下面是我的docker代码。

#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompat 
FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-1803 AS final
EXPOSE 6009/tcp
WORKDIR /WebAPI.Output
COPY WebAPI.Output ./
COPY ./SSRSReportingReferences/t2embed.dll C:/Windows/SysWOW64
ENTRYPOINT ["cmd.exe", "/k", "WebAPI.exe"]

有没有人可以指导我如何在docker镜像中复制或安装中文?

我刚刚遇到了一个类似的问题,我需要中文字体才能正确导出含有中文字符的PDF文件。

我的解决方案是在ENTRYPOINT之前使用以下命令。

RUN apt-get install -y fontconfig fonts-wqy-zenhei
RUN fc-cache -fv

第一条命令安装fontconfig (https://packages.debian.org/sid/fontconfig)和Chinese Fonts (https://packages.debian.org/sid/fonts/)。第二个命令重建字体缓存。

希望这对未来的人有帮助。

最新更新