Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fontconfig error: No writable cache directories #470

Open
sdavids opened this issue Sep 11, 2024 · 1 comment
Open

Fontconfig error: No writable cache directories #470

sdavids opened this issue Sep 11, 2024 · 1 comment

Comments

@sdavids
Copy link

sdavids commented Sep 11, 2024

$ docker run --user "$(id -u):$(id -g)" --rm asciidoctor/docker-asciidoctor:1.76.0 fc-cache
Fontconfig error: No writable cache directories

This surfaces when you use asciidoctor-diagram with PlantUML:

$ mkdir -p /tmp/test && cd "$_"
$ cat << 'EOF' >test.adoc
[plantuml]
----
@startuml

label Test

@enduml
----
EOF
$ docker run \
  --rm \
  -u "$(id -u):$(id -g)" \
  -v '/tmp/test:/documents' \
  asciidoctor/docker-asciidoctor:1.76.0 \
  sh -c 'asciidoctor-pdf -r asciidoctor-diagram test.adoc'
Fontconfig error: No writable cache directories
...

$ docker run \
  --rm \
  -u "$(id -u):$(id -g)" \
  -v '/tmp/test:/documents' \
  asciidoctor/docker-asciidoctor:1.76.0 \
  sh -c 'asciidoctor-pdf -r asciidoctor-diagram test.adoc'

$ rm diag-plantuml-md5-*.png
$ docker run \
  --rm \
  -u "$(id -u):$(id -g)" \
  -v '/tmp/test:/documents' \
  asciidoctor/docker-asciidoctor:1.76.0 \
  sh -c 'asciidoctor-pdf -r asciidoctor-diagram test.adoc'
Fontconfig error: No writable cache directories
...
@sdavids
Copy link
Author

sdavids commented Sep 11, 2024

https://fontconfig.pages.freedesktop.org/fontconfig/fontconfig-user.html#AEN73

$ docker run --user "$(id -u):$(id -g)" --rm -e XDG_CACHE_HOME=/tmp asciidoctor/docker-asciidoctor:1.76.0 sh -c 'fc-cache && ls /tmp/fontconfig'
12b26b760a24f8b4feb03ad48a333a72-le64.cache-9
3830d5c3ddfd5cd38a049b759396e72e-le64.cache-9
51d7d9064f616a814da14ac1dd7116cb-le64.cache-9
5ca8086aeacc9c68e81a71e7ef846b3b-le64.cache-9
6ba42ae0000f58711b5caaf10d690066-le64.cache-9
923e285e415b1073c8df160bee08820f-le64.cache-9
CACHEDIR.TAG
a1c95d6dfc9a7b34f44445cf81166004-le64.cache-9
b67b32625a2bb51b023d3814a918f351-le64.cache-9
c470550e31544075faff60bdbbb5d457-le64.cache-9
$ docker run \
  --rm \
  -u "$(id -u):$(id -g)" \
  -v '/tmp/test:/documents' \
  -e XDG_CACHE_HOME=/tmp \
  asciidoctor/docker-asciidoctor:1.76.0 \
  sh -c 'asciidoctor-pdf -r asciidoctor-diagram test.adoc'

You might want to add ENV XDG_CACHE_HOME=<some world writable location other than /tmp> to your Dockerfile.

so that --user "$(id -u):$(id -g)" can write to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant