Setting up IronWord in Docker Containers

IronWord is fully supported in Docker containers for both Linux and Windows environments, making it ideal for deployment on Azure, AWS, or any . NET-ready host.

Why Use Docker?

Docker lets you package and run IronWord as a lightweight, self-contained container. This ensures consistent behavior across development, testing, and production—especially valuable when generating or manipulating Word documents programmatically.

IronWord supports .NET 5-9, .NET Standard (2.x, 3.x), and .NET Framework 4.6.2+, all of which work seamlessly in Docker on Linux and Windows.

We recommend the following 64‑bit Linux distros for smooth IronWord operation:

  • Ubuntu 22.04+ (Jammy)
  • Ubuntu 20.04 (Focal)
  • Debian 11+ (Bullseye)
  • CentOS7+

Use Microsoft’s official Docker images with the .NET runtime and SDK to simplify setup and dependency management

IronWord NuGet Package

IronWord is easily added to any .NET project through its NuGet package. Simply run the following command in the NuGet Package Manager Console, and it will add the library automatically:

Install-Package IronWord

Ubuntu Dockerfile Examples

Ubuntu22 + .NET8

FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build
WORKDIR /src
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"

COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Example.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Example.dll"]

Ubuntu20.04 + .NET6 (LTS)

FROM mcr.microsoft.com/dotnet/runtime:6.0-focal AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:6.0-focal AS build
WORKDIR /src
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"

COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Example.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Example.dll"]

Debian Dockerfile Example

Debian11 + .NET7

FROM mcr.microsoft.com/dotnet/aspnet:7.0-bullseye-slim AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim AS build
WORKDIR /src
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"

COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Example.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Example.dll"]

CentOS 7

Use CentOS-based .NET runtimes like mcr.microsoft.com/dotnet/runtime:6.0-centos7 for IronWord compatibility.

# Build stage
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /app

COPY ./Example/Example.csproj ./Example/
RUN dotnet restore "./Example/Example.csproj"

COPY ./Example ./Example/
WORKDIR /app/Example
RUN dotnet publish -c Release -o /out

# Runtime stage - CentOS 7
FROM mcr.microsoft.com/dotnet/runtime:6.0-centos7 AS runtime
WORKDIR /app

RUN yum install -y liberation-fonts && yum clean all

COPY --from=build /out ./

ENTRYPOINT ["dotnet", "Example.dll"]

Notes & Troubleshooting

  • IronWord fully supports .NET5–9, .NET Standard (2.x, 3.x), and .NET Framework 4.6.2+.
  • Install fonts if needed (e.g., fonts-liberation, ttf-mscorefonts-installer) on Linux containers for proper rendering.
Kye Stuart
Technical Writer

Kye Stuart merges coding passion and writing skill at Iron Software. Educated at Yoobee College in software deployment, they now transform complex tech concepts into clear educational content. Kye values lifelong learning and embraces new tech challenges.

Outside work, they enjoy PC gaming, streaming on Twitch, and ...Read More

Talk to an Expert Five Star Trust Score Rating

Ready to Get Started?

Nuget Passed