.agents/skills/issue-repro/references/platform-docker-linux.md
Reproduce bugs on Linux using Docker. Use when the host is macOS/Windows, or to test older SkiaSharp versions that lack host-platform native assets.
See also: the issue-fix skill's docker-testing.md for full
dependency matrix and troubleshooting.
Linux, Docker, container, NativeAssets.Linux, fontconfig, "works on Windows/Mac but
not Linux", DllNotFoundException on Linux, case-sensitivity issues, server deployment,
Azure App Service, AWS Lambda.
Also use for:
--platform linux/amd64docker --version--platform linux/amd64 (Rosetta emulation on Apple Silicon)docker run --rm --platform linux/amd64 mcr.microsoft.com/dotnet/sdk:8.0 bash -c '
apt-get update -qq && apt-get install -y -qq libfontconfig1 2>&1 | tail -1
mkdir -p /tmp/skiasharp/repro/{timestamp} && cd /tmp/skiasharp/repro/{timestamp}
dotnet new console -n Repro --framework {reporter_tfm} --no-restore 2>&1 | tail -1
cd Repro
dotnet add package SkiaSharp --version {reporter_version} --no-restore 2>&1 | tail -1
dotnet add package SkiaSharp.NativeAssets.Linux --version {reporter_version} --no-restore 2>&1 | tail -1
cat > Program.cs << "ENDOFFILE"
{reporter_code}
ENDOFFILE
dotnet restore 2>&1 | tail -1
dotnet run 2>&1
'
Adapt the SDK image tag to match {reporter_tfm}:
net6.0 → sdk:6.0net8.0 → sdk:8.0net9.0 → sdk:9.0net10.0 → sdk:10.0⚠️ libfontconfig1 is MANDATORY — without it you get DllNotFoundException for libSkiaSharp.
# Debian/Ubuntu (default SDK images)
apt-get update -qq && apt-get install -y -qq libfontconfig1
# Alpine (sdk:8.0-alpine) — use sh not bash
apk add --no-cache fontconfig
For rendering/font bugs, also install fonts:
apt-get install -y -qq fonts-dejavu-core # Debian
apk add --no-cache ttf-dejavu # Alpine
| Variant | Docker flag | When to use |
|---|---|---|
| Linux x64 (Debian) | --platform linux/amd64 | Default — most common deployment target |
| Linux arm64 (Debian) | --platform linux/arm64 | Native on Apple Silicon, tests arm64 natives |
| Alpine musl | sdk:8.0-alpine | Tests musl libc compatibility |
All output comes through Docker stdout/stderr. Capture the full output of the docker run command.
successfailurewrong-output, conclusion reproduced{
"environment": {
"os": "Linux (Docker)",
"arch": "x64",
"dotnetVersion": "8.0.xxx",
"skiaSharpVersion": "{reporter_version}",
"dockerUsed": true
}
}
Tag versionResults entries with "platform": "docker-linux-x64" (or docker-linux-arm64).
| Problem | Cause | Fix |
|---|---|---|
DllNotFoundException: libSkiaSharp | Missing fontconfig | apt-get install libfontconfig1 |
liblibSkiaSharp.so (double prefix) | RID resolution issue | Add --runtime linux-x64 --no-self-contained |
| Very slow on Apple Silicon | x64 emulation via Rosetta | Normal — allow extra time |
| No arm64 natives for 1.68.x | Version too old | Must use --platform linux/amd64 |
dotnet restore timeout | Network in Docker | Retry or use --no-restore + explicit restore |
| Observation | Conclusion |
|---|---|
| Crash/error matching report | reproduced |
| Code runs correctly | not-reproduced |
| Docker not available | blocker (not needs-platform) |
| Need specific kernel feature Docker can't provide | needs-platform (rare) |
For Docker/Linux bugs, Phase 3C tests the main branch console sample inside Docker:
# Return to the SkiaSharp repo root — ensure native binaries exist
cd "$(git rev-parse --show-toplevel)"
[ -d "output/native" ] && ls output/native/ | head -5 || dotnet cake --target=externals-download
# Build the console sample from source
dotnet build samples/Basic/Console/SkiaSharpSample/SkiaSharpSample.csproj
# Run in Docker with the source-built binary
dotnet publish samples/Basic/Console/SkiaSharpSample/SkiaSharpSample.csproj -r linux-x64 --no-self-contained -o /tmp/skiasharp/repro/{timestamp}/publish/
docker run --rm --platform linux/amd64 -v /tmp/skiasharp/repro/{timestamp}/publish:/app mcr.microsoft.com/dotnet/runtime:8.0 bash -c '
apt-get update -qq && apt-get install -y -qq libfontconfig1 2>&1 | tail -1
cd /app && dotnet SkiaSharpSample.dll 2>&1
'
Alternatively, if the sample doesn't cover the specific bug, temporarily modify
samples/Basic/Console/SkiaSharpSample/Program.cs with the repro code, rebuild, and
run in Docker. Revert with git checkout after recording the result.