Einrichten von IronOCR in Docker-Containern

Curtis Chau
Curtis Chau
Aktualisiert: 21. Juli 2026

Möchten Sie Bilder oder PDF-Dateien in C# mit OCR verarbeiten?

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

Docker Linux AWS 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.

IronOCR und Linux-Grundlagen

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 dringend, unseren IronOCR Linux Setup- und Kompatibilitätsleitfaden zu lesen.

Empfohlene Linux-Docker-Distributionen

Wir empfehlen die folgenden neuesten 64-Bit-Linux-Betriebssysteme für die „einfache Konfiguration“ von IronOCR.

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

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

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

IronOCR-Linux-Docker-Installationsanforderungen

Nutzen Sie unser NuGet-Paket

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

PM > Install-Package IronOcr

Ubuntu Linux DockerFiles

Docker Linux Ubuntu

Ubuntu 20 mit .NET 5

# Use the base runtime image for Ubuntu 20 with .NET runtime
FROM mcr.microsoft.com/dotnet/runtime:5.0-focal AS base
WORKDIR /app

# Install necessary packages
RUN apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev

# Use the base development image for 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 the project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build

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

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

Ubuntu 20 mit .NET 3.1 LTS

# Use the base runtime image for Ubuntu 20 with .NET runtime
FROM mcr.microsoft.com/dotnet/runtime:3.1-focal AS base
WORKDIR /app

# Install necessary packages
RUN apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev

# Use the base development image for 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 the project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build

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

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

Ubuntu 18 mit .NET 3.1 LTS

# Use the base runtime image for Ubuntu 18 with .NET runtime
FROM mcr.microsoft.com/dotnet/runtime:3.1-bionic AS base
WORKDIR /app

# Install necessary packages
RUN apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev

# Use the base development image for 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 the project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build

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

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

Debian Linux DockerFiles

Docker Linux Debian

Debian 11 mit .NET 5

# Use the base runtime image for Debian 11 with .NET runtime
FROM mcr.microsoft.com/dotnet/aspnet:5.0-bullseye-slim AS base
WORKDIR /app

# Install necessary packages
RUN apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev

# Use the base development image for Debian 11 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 the project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build

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

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

Debian 11 mit .NET 3.1 LTS

# Use the base runtime image for Debian 11 with .NET runtime
FROM mcr.microsoft.com/dotnet/aspnet:3.1-bullseye-slim AS base
WORKDIR /app

# Install necessary packages
RUN apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev

# Use the base development image for Debian 11 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 the project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build

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

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

Debian 10 mit .NET 5

# Use the base runtime image for Debian 10 with .NET runtime
FROM mcr.microsoft.com/dotnet/runtime:5.0 AS base
WORKDIR /app

# Install necessary packages
RUN apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev

# Use the base development image for 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 the project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build

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

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

Debian 10 mit .NET 3.1 LTS

# Use the base runtime image for Debian 10 with .NET runtime
FROM mcr.microsoft.com/dotnet/runtime:3.1 AS base
WORKDIR /app

# Install necessary packages
RUN apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev

# Use the base development image for 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 the project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build

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

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

Häufig gestellte Fragen

Was ist IronOCR und wie funktioniert es mit Docker?

IronOCR ist eine fortschrittliche OCR-Bibliothek für .NET, die jetzt auch Docker-Container vollständig unterstützt. Dies ermöglicht die Ausführung von OCR-Anwendungen in einer skalierbaren, portablen und konsistenten Umgebung auf verschiedenen Plattformen wie Linux, Windows und macOS mithilfe von Docker.

Warum sollte ich Docker für meine OCR-Anwendungen verwenden?

Docker ermöglicht es Entwicklern, Anwendungen als leichte, portable und eigenständige Container zu verpacken, zu versenden und auszuführen. Das bedeutet, dass OCR-Anwendungen in jeder Umgebung konsistent ausgeführt werden können, was die Bereitstellung und Entwicklungsprozesse vereinfacht.

Kann ich IronOCR in einem Linux-basierten Docker-Container verwenden?

Ja, IronOCR ist dafür ausgelegt, nahtlos innerhalb von Linux-basierten Docker-Containern zu arbeiten. Die Dokumentation stellt Docker-Dateien für beliebte Linux-Distributionen wie Ubuntu und Debian bereit, um eine einfache Integration sicherzustellen.

Welche Linux-Distributionen werden für die Ausführung von IronOCR in Docker empfohlen?

IronOCR empfiehlt die Verwendung von 64-Bit-Versionen von Ubuntu 20, Ubuntu 18, Debian 11 und Debian 10. Diese Distributionen bieten eine unkomplizierte Konfiguration, obwohl andere Distributionen möglicherweise manuelle Einrichtung erfordern.

Wie installiere ich IronOCR in einem Docker-Container?

Sie können IronOCR in einem Docker-Container installieren, indem Sie das NuGet-Paket verwenden. Die Einrichtung beinhaltet die Erstellung von Docker-Dateien für Ihre spezifische Umgebung und die Einrichtung von Abhängigkeiten mit dem apt-get-Paketmanager.

Ist IronOCR mit verschiedenen Versionen der .NET-Laufzeit kompatibel?

Ja, IronOCR unterstützt verschiedene .NET-Laufzeiten, einschließlich .NET 5 und .NET 3.1 LTS, wie in den Docker-Dateien in der Dokumentation für die Distributionen Ubuntu und Debian demonstriert wird.

Welche Pakete sind erforderlich, um IronOCR in Docker auszuführen?

Um IronOCR in einer Docker-Umgebung auszuführen, müssen wichtige Pakete wie apt-utils, libgdiplus und libc6-dev installiert werden. Diese Abhängigkeiten sind entscheidend für den ordnungsgemäßen Betrieb von .NET-Anwendungen, die IronOCR nutzen.

Kann ich IronOCR mit Azure Docker-Containern verwenden?

Ja, IronOCR ist voll kompatibel mit Azure Docker-Containern, was Ihnen ermöglicht, .NET-OCR-Anwendungen sowohl auf Linux- als auch auf Windows-Plattformen innerhalb des Azure-Ökosystems bereitzustellen und auszuführen.

Was ist der beste Weg, um Docker-Anwendungen mit IronOCR zu entwickeln und zu debuggen?

Für diejenigen, die neu in Docker mit .NET sind, empfiehlt die Dokumentation Ressourcen von Microsoft zur Einrichtung von Docker-Debugging und Integration mit Visual Studio-Projekten. Dieser Ansatz erleichtert eine reibungslosere Entwicklungserfahrung.

Gibt es offizielle Docker-Images, die für IronOCR empfohlen werden?

IronOCR empfiehlt die Verwendung von Microsofts offiziellen Docker-Images für die Ausführung von .NET-Anwendungen. Diese Images sind so konzipiert, dass sie ein hohes Maß an Kompatibilität und Leistung für .NET-basierte Anwendungen bieten.

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 Handbücher.

Mehr lesen

Bereit loszulegen?

NuGet-Downloads 6,411,693Version:2026.11gerade veröffentlicht