我正在尝试在运行Ubuntu 18.04的Docker容器中安装字体(Dockerfile继承自Jupyter scipy笔记本,该笔记本又继承自基础jupyter镜像,Dockerfile链接在这里)。
我尝试了很多不同的方法,包括这个答案和其中的其他建议。
我的Dockerfile如下:
FROM jupyter/scipy-notebook
USER root
# bash instead of dash to use source
RUN ln -snf /bin/bash /bin/sh
# These require sudo so they must come before defining
# a user
# Font attempt
COPY GillSansMTPro-Medium.otf /usr/local/share/fonts
RUN fc-cache -f -v
# installing some pip packages
当我尝试在matplotlib中使用这个字体时,我看到了这个错误:
![error message](https://istack.dev59.com/f9Pn2.webp)
RUN rm -fr ~/.cache/matplotlib
在我的 Dockerfile 中(在上面显示的部分之后)添加了这一行,因为我在线上读到说它可能解决问题。但是它也没有起作用。
另外,如果我导航到/usr/local/share/fonts
,我可以看到预期的字体。
有任何解决办法吗?