Skip to content

Fontconfig error with new alpine image #7012

Closed

Description

@micgruber

Describe the bug

Switching from mcr.microsoft.com/dotnet/aspnet:8.0-alpine3.22 to mcr.microsoft.com/dotnet/aspnet:8.0-alpine or mcr.microsoft.com/dotnet/aspnet:8.0-alpine3.23 I get the following error when we create a devexpress report in the container:

Fontconfig error: No writable cache directories
/var/cache/fontconfig
/.cache/fontconfig
/.fontconfig

With the old one it worked fine. Are there any changes between the two images which cause this error.

Which .NET image(s) are you using?

mcr.microsoft.com/dotnet/aspnet:8.0-alpine

Steps to reproduce

No response

Other information

No response

Output of docker version

Output of docker info

Activity

  1. richlander commented on Jan 23, 2026

    @richlander
    Member

    Can you share your Dockerfile or the relevent parts of it?

  2. micgruber commented on Jan 23, 2026

    @micgruber
    Author

    This is the docker file I renamed a few things and removed the copy commands of the code. When I update the image FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine3.22 to:

    • mcr.microsoft.com/dotnet/aspnet:8.0-alpine
    • mcr.microsoft.com/dotnet/aspnet:8.0-alpine3.23

    I get the error message.

    #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
    
    FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine3.22 AS base
    
    WORKDIR /usr/local/share/ca-certificates
    COPY ["Certificates/cert.crt", "."]
    COPY ["Certificates/cert.crt", "."]
    RUN apk add --upgrade ca-certificates 
    RUN /usr/sbin/update-ca-certificates
    
    WORKDIR /app
    EXPOSE 80
    # install System.Drawing native dependencies
    RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
        apk update && \
        apk upgrade && \
        apk add icu-libs icu-data-full libgdiplus@testing pango cairo icu-dev harfbuzz freetype fontconfig meson && \
        rm -rf /var/cache/apk/* && \
        apk add ttf-dejavu && \
        fc-cache -f
    
    ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
    
    COPY ./Api/Report/Api/fonts ~/.fonts
    COPY ./Api/Report/Api/fonts /usr/shared/fonts
    COPY ./Api/Report/Api/fonts /usr/share/fonts/truetype
    
    FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
    
    WORKDIR /usr/local/share/ca-certificates
    COPY ["Certificates/cert.crt", "."]
    COPY ["Certificates/cert.crt", "."]
    RUN apk add --upgrade ca-certificates 
    RUN /usr/sbin/update-ca-certificates
    
    WORKDIR /src
    
    
    # Personal access token to access Artifacts feed
    
    ARG ACCESS_TOKEN
    ARG ARTIFACTS_ENDPOINT_L
    ARG ARTIFACTS_ENDPOINT_K
    ARG DEVEXPRESS_LICENSE
    ARG EPPLUS_LICENSE
    
    ENV DevExpress_License=${DEVEXPRESS_LICENSE}
    ENV EPPlusLicense=${EPPLUS_LICENSE}
    
    # Install the Credential Provider to configure the access
    ENV ARTIFACTS_CREDENTIAL_PROVIDER_NON_SC 1
    RUN curl -L 'https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh' | sh
    
    # Configure the environment variables
    
    ENV NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED true
    ENV VSS_NUGET_EXTERNAL_FEED_ENDPOINTS "{\"endpointCredentials\": [{\"endpoint\":\"${ARTIFACTS_ENDPOINT_L}\", \"password\":\"${ACCESS_TOKEN}\"},{\"endpoint\":\"${ARTIFACTS_ENDPOINT_K}\", \"password\":\"${ACCESS_TOKEN}\"}]}"
    
    COPY ["nuget.config", "."]
    COPY ["...", "..."]
    RUN dotnet restore "Api/Report/Api/Api.csproj"
    COPY . .
    WORKDIR "/src/Api/Report/Api"
    RUN dotnet build "Api.csproj" -c Release -o /app/build
    
    FROM build AS publish
    RUN dotnet publish "Api.csproj" -c Release -o /app/publish
    
    FROM base AS final
    WORKDIR /app
    COPY --from=publish /app/publish .
    ENTRYPOINT ["dotnet", "Api.dll"]
    
  3. lbussell commented on Jan 26, 2026

    @lbussell
    Member

    [Triage] We didn't change anything in Alpine images when updating from 3.22 to 3.23. Something must have changed in the Alpine base image. Perhaps try looking at the fontconfig changes between 3.22 and 3.23:

  4. lbussell commented on Feb 2, 2026

    @lbussell
    Member

    [Triage] I'm converting this issue to a discussion since this appears to be related to the base Alpine image and not something we are adding/configuring when installing .NET.

  5. locked and limited conversation to collaborators on Feb 2, 2026
  6. converted this issue into a discussion #7024 on Feb 2, 2026
  7. moved this from Backlog to Done in .NET Dockeron Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions