IronOCR in Docker-Containern – OCR Software für Bild zu Text und PDF
Wollen Sie Bilder oder PDF-Dateien in C# OCRen? Mit IronOCR können Sie Bild zu Text umwandeln und PDF Text extrahieren in containerisierten Umgebungen.
IronOCR unterstützt jetzt vollständig Docker, einschließlich Azure Docker-Containern für Linux und Windows – ideal für skalierbare Texterkennung in der Cloud.
![]()
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 auch dringend, unseren IronOCR Linux Einrichtungs- 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]
Wir empfehlen die Verwendung von Microsofts Offiziellen Docker Images. Andere Linux-Distributionen werden teilweise unterstützt, erfordern jedoch möglicherweise eine manuelle Konfiguration mit apt-get. Siehe unseren "Linux-Manuellen Einrichtungsleitfaden".
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.
Install-Package IronOcr
Ubuntu Linux DockerFiles
![]()
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"]
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"]
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"]
Debian Linux DockerFiles
![]()
Debian 11 mit .NET 5
# Use the base runtime image for Debian 10 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 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 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"]
Debian 11 mit .NET 3.1 LTS
# Use the base runtime image for Debian 10 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 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 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"]
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"]
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"]Häufig gestellte Fragen
Wie kann ich C# OCR-Anwendungen in Docker-Containern bereitstellen?
Sie können C# OCR-Anwendungen in Docker-Containern bereitstellen, indem Sie IronOCR verwenden, eine C#-OCR-Bibliothek, die mit Docker integriert ist. Sie müssen die Docker-Container mit den notwendigen Paketen wie apt-utils, libgdiplus und libc6-dev einrichten und Microsofts offizielle Docker-Images für optimale Leistung verwenden.
Welche Betriebssysteme eignen sich am besten für die Ausführung von IronOCR in Docker?
Für die Ausführung von IronOCR in Docker wird empfohlen, die neuesten 64-Bit-Linux-Distributionen wie Ubuntu 20, Ubuntu 18, Debian 11 und Debian 10 zu verwenden, da sie eine einfache Konfiguration und Unterstützung bieten.
Wie konfiguriere ich IronOCR auf Azure Docker-Containern?
Um IronOCR auf Azure Docker-Containern zu konfigurieren, befolgen Sie die gleichen Schritte wie für andere Docker-Umgebungen. Verwenden Sie das IronOcr NuGet-Paket, richten Sie die empfohlenen Linux-Distributionen ein und stellen Sie sicher, dass alle notwendigen Abhängigkeiten in Ihrem Dockerfile enthalten sind.
Welche Schritte gibt es, um IronOCR mit .NET 5 in Docker einzurichten?
Um IronOCR mit .NET 5 in Docker einzurichten, müssen Sie ein Dockerfile erstellen, das das IronOcr NuGet-Paket installiert, erforderliche Pakete wie apt-utils und libgdiplus hinzufügt und die offiziellen .NET 5 Docker-Bilder von Microsoft für das Basisimage verwendet.
Kann IronOCR in Docker-Umgebungen auf Windows verwendet werden?
Ja, IronOCR kann in Docker-Umgebungen auf Windows verwendet werden. Der Prozess beinhaltet die Verwendung des IronOcr NuGet-Pakets und die Konfiguration des Dockerfiles, um notwendige Abhängigkeiten und Konfigurationen spezifisch für Windows-Betriebssysteme einzuschließen.
Was sind die Vorteile der Verwendung von Docker zum Hosten von .NET OCR-Anwendungen?
Die Verwendung von Docker zum Hosten von .NET OCR-Anwendungen ermöglicht eine einfache Bereitstellung, eine bessere Ressourcenverwaltung und eine größere Portabilität zwischen verschiedenen Umgebungen. Docker-Container sind eigenständig und sorgen dafür, dass Anwendungen unabhängig davon, wo sie bereitgestellt werden, konsistent ausgeführt werden.
Ist eine manuelle Konfiguration für nicht empfohlene Linux-Distributionen in Docker erforderlich?
Ja, wenn Sie Linux-Distributionen verwenden, die von den empfohlenen (Ubuntu 20, Ubuntu 18, Debian 11, Debian 10) abweichen, müssen Sie möglicherweise manuelle Konfigurationen mit apt-get durchführen. Anleitungen zur manuellen Einrichtung finden Sie im Leitfaden 'Linux Manual Setup', der von IronOCR bereitgestellt wird.

