Setting up IronXL in Docker Containers

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

Möchten Sie Excel-Tabellen Dateien mit C# lesen, bearbeiten und erstellen?

IronXL unterstützt jetzt vollständig Docker, einschließlich Azure-Docker-Containern für Linux und Windows.

Docker Azure Linux Amazon Windows

Warum Docker verwenden?

Docker ermöglicht es Entwicklern, jede Anwendung als leichtgewichtigen, portablen, eigenständigen Container einfach zu verpacken, zu versenden und auszuführen, der praktisch überall laufen kann.

IronXL und Linux-Einführung

Wenn Docker mit .NET neu für Sie ist, empfehlen wir diesen ausgezeichneten Artikel über das Einrichten von Docker-Debugging und die Integration in Visual Studio-Projekte. https://docs.microsoft.com/en-us/visualstudio/containers/edit-and-refresh?view=vs-2019

Wir empfehlen Ihnen auch dringend, unseren IronXL Linux-Setup- und Kompatibilitätsleitfaden zu lesen.

Empfohlene Linux-Docker-Distributionen

Wir empfehlen die neuesten 64-Bit-Linux-Betriebssysteme unten für eine "einfache Konfiguration" von IronPDF.

  • Ubuntu 20
  • Ubuntu 18
  • Debian 11
  • Debian 10 [Derzeit der Microsoft Azure Standard-Linux-Distro]
  • CentOS 7
  • CentOS 8

Wir empfehlen die Verwendung von Microsofts Offiziellen Docker Images. Andere Linux-Distros werden teilweise unterstützt, erfordern jedoch möglicherweise eine manuelle Konfiguration mithilfe von apt-get. Siehe unseren Leitfaden "Linux Manuelle Einrichtung".

Funktionsfähige Docker-Dateien für Ubuntu und Debian sind in diesem Dokument enthalten:

IronXL Linux Docker Installationsgrundlagen

Nutzen Sie unser NuGet-Paket

Wir empfehlen die Verwendung des IronXL NuGet-Pakets. Es funktioniert beim Entwickeln unter Windows, macOS und Linux.

Install-Package IronXL.Excel

Ubuntu Linux DockerFiles

Docker Ubuntu

Ubuntu 20 mit .NET 5

# Base runtime image (Ubuntu 20 with .NET runtime)
FROM mcr.microsoft.com/dotnet/runtime:5.0-focal AS base
WORKDIR /app

# Base development image (Ubuntu 20 with .NET SDK)
FROM mcr.microsoft.com/dotnet/sdk:5.0-focal AS build
WORKDIR /src

# Restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"

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

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

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

Ubuntu 20 mit .NET 3.1 LTS

# Base runtime image (Ubuntu 20 with .NET runtime)
FROM mcr.microsoft.com/dotnet/runtime:3.1-focal AS base
WORKDIR /app

# Base development image (Ubuntu 20 with .NET SDK)
FROM mcr.microsoft.com/dotnet/sdk:3.1-focal AS build
WORKDIR /src

# Restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"

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

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

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

Ubuntu 18 mit .NET 3.1 LTS

# Base runtime image (Ubuntu 18 with .NET runtime)
FROM mcr.microsoft.com/dotnet/runtime:3.1-bionic AS base
WORKDIR /app

# Base development image (Ubuntu 18 with .NET SDK)
FROM mcr.microsoft.com/dotnet/sdk:3.1-bionic AS build
WORKDIR /src

# Restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"

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

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

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

Debian Linux DockerFiles

Debian 11 mit .NET 5

# Base runtime image (Debian 10 with .NET runtime)
FROM mcr.microsoft.com/dotnet/aspnet:5.0-bullseye-slim AS base
WORKDIR /app

# Base development image (Debian 10 with .NET SDK)
FROM mcr.microsoft.com/dotnet/sdk:5.0-bullseye-slim AS build
WORKDIR /src

# Restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"

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

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

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

Debian 11 mit .NET 3.1 LTS

# Base runtime image (Debian 10 with .NET runtime)
FROM mcr.microsoft.com/dotnet/aspnet:3.1-bullseye-slim AS base
WORKDIR /app

# Base development image (Debian 10 with .NET SDK)
FROM mcr.microsoft.com/dotnet/sdk:3.1-bullseye-slim AS build
WORKDIR /src

# Restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"

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

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

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

Debian 10 mit .NET 5

# Base runtime image (Debian 10 with .NET runtime)
FROM mcr.microsoft.com/dotnet/runtime:5.0 AS base
WORKDIR /app

# Base development image (Debian 10 with .NET SDK)
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src

# Restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"

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

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

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

Debian 10 mit .NET 3.1 LTS

# Base runtime image (Debian 10 with .NET runtime)
FROM mcr.microsoft.com/dotnet/runtime:3.1 AS base
WORKDIR /app

# Base development image (Debian 10 with .NET SDK)
FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
WORKDIR /src

# Restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"

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

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

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

CentOS 7 mit .NET 3.1 LTS

# Base runtime image (CentOS 7)
FROM centos:7 AS base
WORKDIR /app

# Install necessary packages
RUN yum install sudo -y
RUN sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
RUN sudo yum install dotnet-sdk-3.1 -y
RUN sudo yum install aspnetcore-runtime-3.1 -y
RUN sudo yum install dotnet-runtime-3.1 -y
RUN sudo yum update -y

WORKDIR /src

# Restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"

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

# Publish project
FROM base AS publish
WORKDIR /src
COPY . .
RUN dotnet publish "Example.csproj" -c Release -o /app/publish

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

CentOS 8 mit .NET 3.1 LTS

# Base runtime image (CentOS 8)
FROM centos:8 AS base
WORKDIR /app

# Install necessary packages
RUN yum install sudo -y
RUN sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
RUN sudo yum install dotnet-sdk-3.1 -y
RUN sudo yum install aspnetcore-runtime-3.1 -y
RUN sudo yum install dotnet-runtime-3.1 -y
RUN sudo yum update -y

WORKDIR /src

# Restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"

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

# Publish project
FROM base AS publish
WORKDIR /src
COPY . .
RUN dotnet publish "Example.csproj" -c Release -o /app/publish

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

Häufig gestellte Fragen

Wie kann ich IronXL in einem Docker-Container einrichten?

Um IronXL in einem Docker-Container einzurichten, müssen Sie das IronXL NuGet-Paket verwenden, das mit Windows, macOS und Linux kompatibel ist. Installieren Sie es mit dem Befehl: dotnet add package IronXL. Für Docker integrieren Sie das Paket in Ihr Dockerfile und stellen Sie sicher, dass Ihre Anwendung auf die notwendigen Bibliotheken und Abhängigkeiten zugreifen kann.

Welche Vorteile bietet die Verwendung von Docker für Excel-Anwendungen?

Mit Docker können Sie Excel-Anwendungen als leichte, tragbare Container verpacken, versenden und ausführen, was Konsistenz und Effizienz über verschiedene Umgebungen hinweg gewährleistet. Dies hilft dabei, eine stabile und reproduzierbare Entwicklungs- und Produktionsumgebung zu erhalten.

Welche Linux-Distributionen funktionieren am besten mit IronXL in Docker?

Die empfohlenen Linux-Distributionen für die Konfiguration von IronXL in Docker sind Ubuntu 18, Ubuntu 20, Debian 10, Debian 11, CentOS 7 und CentOS 8. Diese Distributionen bieten eine stabile Umgebung für Docker-Container, in denen Excel-Anwendungen ausgeführt werden.

Kann ich IronXL sowohl in Windows- als auch in Linux-Docker-Containern verwenden?

Ja, IronXL unterstützt Docker-Container auf sowohl Windows- als auch Linux-Plattformen. Dazu gehören Container, die auf Azure gehostet werden, und bieten flexible Bereitstellungsoptionen.

Welche Docker-Images werden für .NET-Anwendungen mit IronXL empfohlen?

Für .NET-Anwendungen mit IronXL wird empfohlen, die offiziellen Docker-Images von Microsoft für .NET-Runtime und SDK zu verwenden. Diese Images sind für .NET-Anwendungen optimiert und sind auf Docker Hub zu finden.

Wie kann ich Probleme mit IronXL in einer Docker-Umgebung beheben?

Sollten Sie auf Probleme mit IronXL in Docker stoßen, stellen Sie sicher, dass alle Abhängigkeiten korrekt in Ihrem Docker-Container installiert sind. Überprüfen Sie Ihre Dockerfile-Konfiguration und stellen Sie sicher, dass die richtige .NET-Version verwendet wird. Ziehen Sie die IronXL-Dokumentation und die offiziellen Docker-Fehlerbehebungsanleitungen zurate, um weitere Hilfe zu erhalten.

Welche Ressourcen stehen zur Verfügung, um mehr über die Integration von Docker und IronXL zu erfahren?

Für weiterführendes Lernen über die Integration von Docker und IronXL beziehen Sie sich auf die Microsoft-Dokumentation zu Docker für .NET und Visual Studio-Projekte. Zusätzlich bietet der Linux-Setup-Leitfaden von IronXL wertvolle Informationen für das Einrichten von Docker-Umgebungen.

Curtis Chau
Technischer Autor

Curtis Chau hat einen Bachelor-Abschluss in Informatik von der Carleton University und ist spezialisiert auf Frontend-Entwicklung mit Expertise in Node.js, TypeScript, JavaScript und React. Leidenschaftlich widmet er sich der Erstellung intuitiver und ästhetisch ansprechender Benutzerschnittstellen und arbeitet gerne mit modernen Frameworks sowie der Erstellung gut strukturierter, optisch ansprechender ...

Weiterlesen
Bereit anzufangen?
Nuget Downloads 1,686,155 | Version: 2025.11 gerade veröffentlicht