dockerfile 安装linux系统字体
时间: 2023-08-25 21:17:03 浏览: 41
你可以在 Dockerfile 中使用以下命令安装 Linux 系统字体:
```
RUN apt-get update && apt-get install -y fontconfig && \
mkdir -p /usr/share/fonts/truetype/custom && \
wget -qO- https://github.com/google/fonts/blob/master/ofl/opensans/OpenSans-Regular.ttf?raw=true > /usr/share/fonts/truetype/custom/OpenSans-Regular.ttf && \
wget -qO- https://github.com/google/fonts/blob/master/ofl/opensans/OpenSans-Bold.ttf?raw=true > /usr/share/fonts/truetype/custom/OpenSans-Bold.ttf && \
fc-cache -f -v
```
这个例子中,我们安装了 `fontconfig` 包,这是一个字体配置工具。然后我们创建了一个目录 `/usr/share/fonts/truetype/custom`,用于存储自定义字体。最后,我们使用 `wget` 命令下载了两个 Google 开源字体文件,并将它们保存到 `/usr/share/fonts/truetype/custom` 目录下。最后,我们运行了 `fc-cache` 命令,以便系统可以识别这些新安装的字体。