Setting up IronWord in Docker Containers

This article was translated from English: Does it need improvement?
Translated
View the article in English

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.

Questions Fréquemment Posées

Qu'est-ce qu'IronWord et pourquoi l'utiliser dans un conteneur Docker ?

IronWord est une bibliothèque pour travailler avec des documents Word dans des applications .NET. L'utiliser dans un conteneur Docker permet un comportement cohérent à travers les environnements de développement, de test et de production sous Linux et Windows.

Quelles distributions Linux sont recommandées pour exécuter IronWord dans Docker ?

IronWord fonctionne sans problème sur des distributions Linux 64 bits telles qu'Ubuntu 22.04+ (Jammy), Ubuntu 20.04 (Focal), Debian 11+ (Bullseye), et CentOS 7+.

Comment ajouter IronWord à un projet .NET en utilisant NuGet ?

IronWord peut être ajouté à un projet .NET en exécutant la commande d'installation dans la console du gestionnaire de packages NuGet, ce qui inclut automatiquement la bibliothèque dans votre projet.

Quel est l'avantage d'utiliser les images Docker officielles de Microsoft pour IronWord ?

L'utilisation des images Docker officielles de Microsoft avec le runtime et le SDK .NET simplifie l'installation et la gestion des dépendances, assurant une intégration transparente avec IronWord.

Quels sont quelques exemples de Dockerfiles pour configurer IronWord sur Ubuntu ?

La page fournit des exemples de Dockerfiles pour Ubuntu 22 avec .NET 8 et Ubuntu 20.04 avec .NET 6, détaillant les étapes de la configuration de l'image de base à l'exécution de l'application.

Comment puis-je configurer IronWord sur Debian en utilisant Docker ?

Un exemple de Dockerfile pour Debian 11 avec .NET 7 est fourni, qui comprend les étapes pour construire et déployer l'application IronWord dans un conteneur Docker.

Est-il nécessaire d'installer des polices supplémentaires pour IronWord sur les conteneurs Linux ?

Oui, l'installation de polices telles que fonts-liberation ou ttf-mscorefonts-installer peut être nécessaire sur les conteneurs Linux pour un rendu correct des documents lorsque l'on utilise IronWord.

IronWord prend-il en charge toutes les versions de .NET ?

IronWord prend en charge .NET 5-9, .NET Standard (2.x, 3.x), et .NET Framework 4.6.2+, ce qui le rend polyvalent pour différentes versions d'applications .NET.

Quelles sont les étapes pour déployer une application IronWord sur CentOS 7 ?

La page décrit un Dockerfile pour CentOS 7, qui inclut l'utilisation d'un runtime .NET 6, l'installation des polices nécessaires, et la configuration de l'environnement pour exécuter des applications IronWord.

Pourquoi choisir Docker pour déployer des applications IronWord ?

Docker garantit que les applications IronWord bénéficient d'un environnement léger et autonome, offrant des performances cohérentes à travers les différentes étapes du développement et du déploiement des applications.

Kye Stuart
Rédacteur technique

Kye Stuart fusionne la passion du codage et l'habileté rédactionnelle chez Iron Software. Éduqué au Yoobee College en déploiement de logiciels, ils transforment maintenant des concepts technologiques complexes en contenu éducatif clair. Kye valorise l'apprentissage tout au long de la vie et relève de nouveaux dé...

Lire la suite
Prêt à commencer?
Nuget Téléchargements 25,807 | Version : 2025.11 vient de sortir