2
如何在容器内安装字体文件
source link: https://bajie.dev/posts/20230706-fonts_in_pod/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
如何在容器内安装字体文件
2023-07-06
1 分钟阅读
pod 容器内要用中文雅黑字体生成 jpg 图片,没办法,只能把字体给装进去
首先进入容器,确定容器的基底是什么,是yum、apt或者apk
通常都是用apk最小化安装的,这样做法如下:
apk update
apk add --update ttf-dejavu fontconfig
rm -rf /var/cache/apk/*
mkdir /usr/share/fonts/chinese
cp /usr/local/jre1.8.0_201/lib/fonts/simsun.ttc /usr/share/fonts/chinese
mkfontscale && mkfontdir && fc-cache
这样就搞定了,当然这只是临时的。
要想长久就得修改Dockerfile,把文件拷进容器,然后同样得执行命令即可。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK