Because most of the mirror on the docker are based on linux system, so when the image writing Chinese need to consider Chinese font problems, such as microsoft / aspnetcore2.0 this image, which is based on debian system, which has only one top English font, so there will be when the Chinese garbled output, this is normal, our solution also requires the following steps to pressing!
Performance issues
- The system linux
- The docker container
- On dotnetcore System.Drawing text output
Solutions
- dockerfile in the dynamic Chinese fonts installed, activate fonts
- dotnetcore in the new font added, many of the online presentation is WenQuanYi being black, note its name, not a mistake, you can also use the alphabetical name WenQuanYi Zen Hei, note that there is a space
- docker build --no-cache. Run your dockerfile generate a new image, docker run your image to
Specific code
Dockerfile in a dynamically add fonts and refresh
FROM microsoft/aspnetcore:2.0 WORKDIR /app EXPOSE 80 RUN ls COPY publish . COPY sources.list /etc/apt/sources.list RUN apt-get update && apt-get -y install libgdiplus RUN apt-get -y install fonts-wqy-zenhei && apt-get clean && fc-cache -fv ENTRYPOINT ["dotnet", "FileUpload.dll"]
Production of two Chinese fonts in System.Drawing
= FTitle font new new font ( " WenQuanYi n-black " , 16 ); font ftext = new new font ( " WenQuanYi Zen Hei " , . 9 );
Three simultaneous access to container, see already installed Chinese fonts
fc-list: lang = zh //: a space in front of No.
In fact, by displaying the current linux it is the container where the operating system supports Chinese font, the output of Chinese when you need to use the font on the image above!
System.Drawing environment to build on dotnetcore can see my article: DotNetCore cross-platform ~ System.DrawingCore deploy Linux Note
Thanks for reading!