ADR: Linux containers over Windows
Status: accepted in practice since the first image; written down 2026-09-01.
In plain words
The site's container runs on Linux even though the app is built on a Windows machine. Nothing in the app needs Windows, and the Linux image is a fraction of the size of a Windows one.
What that is worth: a developer gets one image that runs the same on the laptop as in production, and the organization moved the site to a new host without changing the build file (Dockerfile).
Context
The application is built on a Windows machine, so Windows containers were
the default-looking choice. The Dockerfile went Linux instead: a
node:22-alpine build stage and the aspnet:10.0 Linux runtime. A week of
shipping has turned that instinct into reasons.
Decision
Linux containers, everywhere the image runs.
The reasons, as learned
- .NET 10 is fully cross-platform. Nothing in this application touches a
Windows API, so Windows in the runtime would carry cost without buying
anything.
- Size is a tax paid on every push and every pull. The Linux runtime image
keeps the whole application under a few hundred megabytes; Windows base
images are gigabytes before the first line of app code arrives. This
registry gets fed over a home connection, and the container group pulls
the image on every roll.
- The identity design requires it. The registry pull rides a user-assigned
managed identity, and that capability belongs to Linux container groups
on Azure Container Instances; Microsoft's own Q&A is a trail of Windows
container groups failing at exactly this.
- The hardening came free. The Linux aspnet image ships a built-in
non-root user, and the healthcheck is one curl line.
- One image works everywhere it needs to: Docker Desktop runs it on the
Windows dev machine through WSL2, GitHub's ubuntu runners will build it
in CI, and ACI runs it in production. Same bytes, three hosts.
Consequences
- The dev machine needed WSL2, installed on provisioning day, a one-time
cost.
- Anything Windows-specific that creeps into the runtime is refused by the
container. That constraint is a feature.
Addendum, 2026-09-20: the same image, on a different host
Superseded in part on 2026-09-20, as 1.0.0.156: the image no longer runs on Container Instances.
Both sites are web apps for containers on one Linux App Service plan (ADR: One plan, two sites).
The decision stands and did its job again: the same Linux image moved hosts with no change to the
Dockerfile, which is the reason the first record gives for having a container at all. One of the
reasons above moved with it. The registry pull still rides the user-assigned identity, and on App
Service that is two properties on the site, acrUseManagedIdentityCreds and the identity's client
id, rather than a capability of Linux container groups.
Where it sits
No ring: choosing Linux for the container is a hosting decision about the base images, and the code's layering and SOLID are untouched by it.
Files
FROM mcr.microsoft.com/dotnet/aspnet:11.0 AS runtime
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
COPY --chown=app:app --from=api-publish /app/publish/ /app/
COPY --chown=app:app README.md ./
COPY --chown=app:app docs ./docs
COPY --chown=app:app data ./data
COPY --chown=app:app infra ./infra
COPY --chown=app:app src ./src
COPY --chown=app:app .github/workflows ./.github/workflows
COPY --chown=app:app .github/quality.py ./.github/
COPY --chown=app:app .github/quality-ratchet.json ./.github/
COPY --chown=app:app .coderabbit.yaml ./
COPY --chown=app:app .vscode ./.vscode
COPY --chown=app:app api/TheYard.slnx ./api/
COPY --chown=app:app api/TheYard.Api/*.cs api/TheYard.Api/*.csproj ./api/TheYard.Api/
COPY --chown=app:app api/TheYard.Api/Shared ./api/TheYard.Api/Shared
COPY --chown=app:app api/TheYard.Api/Features ./api/TheYard.Api/Features
COPY --chown=app:app api/TheYard.Application/*.csproj ./api/TheYard.Application/
COPY --chown=app:app api/TheYard.Application/Features ./api/TheYard.Application/Features
COPY --chown=app:app api/TheYard.Application/Shared ./api/TheYard.Application/Shared
COPY --chown=app:app api/TheYard.Data/*.cs api/TheYard.Data/*.csproj ./api/TheYard.Data/
COPY --chown=app:app api/TheYard.Domain/*.csproj ./api/TheYard.Domain/
COPY --chown=app:app api/TheYard.Domain/Features ./api/TheYard.Domain/Features
COPY --chown=app:app api/TheYard.Domain/Shared ./api/TheYard.Domain/Shared
COPY --chown=app:app api/TheYard.Infrastructure/*.cs api/TheYard.Infrastructure/*.csproj ./api/TheYard.Infrastructure/
COPY --chown=app:app api/TheYard.Infrastructure/Features ./api/TheYard.Infrastructure/Features
COPY --chown=app:app api/TheYard.Infrastructure/Shared ./api/TheYard.Infrastructure/Shared
COPY --chown=app:app api/TheYard.Infrastructure.Cosmos/*.csproj ./api/TheYard.Infrastructure.Cosmos/
COPY --chown=app:app api/TheYard.Infrastructure.Cosmos/Features ./api/TheYard.Infrastructure.Cosmos/Features
COPY --chown=app:app api/TheYard.Infrastructure.Cosmos/Shared ./api/TheYard.Infrastructure.Cosmos/Shared
COPY --chown=app:app api/TheYard.Experiment/*.cs api/TheYard.Experiment/*.csproj ./api/TheYard.Experiment/
COPY --chown=app:app api/TheYard.Migrations.Sqlite/*.cs api/TheYard.Migrations.Sqlite/*.csproj ./api/TheYard.Migrations.Sqlite/
COPY --chown=app:app functions/jobhunt/*.cs ./functions/jobhunt/
COPY --chown=app:app functions/jobhunt.Tests ./functions/jobhunt.Tests
COPY --chown=app:app server/JobHunt.Server.Application/Features/Archive ./server/JobHunt.Server.Application/Features/Archive
COPY --chown=app:app api/TheYard.Database ./api/TheYard.Database
COPY --chown=app:app api/TheYard.Tests/*.cs api/TheYard.Tests/*.csproj ./api/TheYard.Tests/
COPY --chown=app:app Dockerfile netlify.toml playwright.config.ts vite.config.ts package.json index.html tsconfig.json tsconfig.app.json tsconfig.node.json .editorconfig ./
COPY --chown=app:app edge ./edge
COPY --chown=app:app tests ./tests
COPY --chown=app:app scripts ./scripts
COPY --chown=app:app render ./render
COPY --chown=app:app samples/theshed/tests/TestProject.Tests/OnionTests.cs ./samples/theshed/tests/TestProject.Tests/
COPY --chown=app:app --from=api-publish /app/shed/ /app/shed/
COPY --chown=app:app --from=frontend-build /src/dist/ /app/wwwroot/
ARG APP_VERSION=dev
ARG APP_COMMIT=local
ENV APP_VERSION=${APP_VERSION}
ENV APP_COMMIT=${APP_COMMIT}
ENV SHED_COMMIT=${APP_COMMIT}
ENV Shed__ContentRoot=/app/shed
ENV ASPNETCORE_URLS=http://+:8080
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 CMD curl -fsS http://localhost:8080/healthz || exit 1
RUN mkdir -p /app/state && chown app:app /app/state
ENV ConnectionStrings__Yard="Data Source=/app/state/yard.db"
USER app
ENTRYPOINT ["dotnet", "TheYard.Api.dll"]
Live from Dockerfile, region runtime, read from this build at 99df7a8.
Addendum, 2026-10-03: the build stage is Node 24
The build stage moved from node:22-alpine to node:24-alpine, and CI from Node 22 to Node 24, because 22 is in maintenance and 24 is the active long-term release (ADR: Technology versions). Nothing else in the stage changed.
Enforced by
Not machine-checked. Held by review.