IronOCR 开始 Docker 设置指南 在 Docker 容器中设置 IronOCR Curtis Chau 已更新:六月 9, 2025 下载 IronOCR NuGet 下载 DLL 下载 Windows 安装程序 免费试用 法学硕士副本 法学硕士副本 将页面复制为 Markdown 格式,用于 LLMs 在 ChatGPT 中打开 向 ChatGPT 咨询此页面 在双子座打开 向 Gemini 询问此页面 在双子座打开 向 Gemini 询问此页面 打开困惑 向 Perplexity 询问有关此页面的信息 分享 在 Facebook 上分享 分享到 X(Twitter) 在 LinkedIn 上分享 复制链接 电子邮件文章 This article was translated from English: Does it need improvement? Translated View the article in English 想在 C# 中对图像或 PDF 文件进行 OCR 识别吗? IronOCR 现在完全支持 Docker,包括适用于 Linux 和 Windows 的 Azure Docker 容器。 为什么使用 Docker? Docker 使开发人员能够轻松地将任何应用程序打包、发布和运行为轻量级、可移植、自给自足的容器,并且可以在几乎任何地方运行。 IronOCR 和 Linux 入门 如果您是第一次接触 Docker 与 .NET,我们推荐您阅读这篇关于设置 Docker 调试以及如何将其与 Visual Studio 项目集成的优秀文章。 https://docs.microsoft.com/en-us/visualstudio/containers/edit-and-refresh?view=vs-2019 我们也强烈建议您阅读我们的IronOCR Linux 设置和兼容性指南。 推荐的 Linux Docker 发行版 我们推荐最新的64位 Linux 操作系统以便"轻松配置" IronPDF。 Ubuntu 20 Ubuntu 18 Debian 11 Debian 10 [目前是 Microsoft Azure 的默认 Linux 发行版] 我们建议使用微软官方的 Docker 镜像。 其他 Linux 发行版也部分受支持,但可能需要使用apt-get进行手动配置。 请参阅我们的" Linux 手动安装指南"。 本文档中包含适用于 Ubuntu 和 Debian 的 Docker 文件: IronOCR Linux Docker 安装要点 使用我们的 NuGet 包 我们建议使用IronOCR NuGet 包。 它在 Windows、macOS 和 Linux 系统上进行开发时均可正常工作。 Install-Package IronOcr Ubuntu Linux Dockerfiles Ubuntu 20 with .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 with .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 with .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 with .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 with .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 with .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 with .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"] 常见问题解答 如何在 Docker 容器中部署 C# OCR 应用程序? 您可以通过使用 IronOCR,在 Docker 容器中部署 C# OCR 应用程序,IronOCR 是一个与 Docker 集成的 C# OCR 库。您需要设置包含必要包的 Docker 容器,如 apt-utils、libgdiplus 和 libc6-dev,并使用微软的官方 Docker 镜像以实现最佳性能。 哪些操作系统最适合在 Docker 中运行 IronOCR? 为了在 Docker 中运行 IronOCR,推荐使用最新的 64 位 Linux 发行版,如 Ubuntu 20、Ubuntu 18、Debian 11 和 Debian 10,因为它们提供了简单的配置和支持。 如何在 Azure Docker 容器上配置 IronOCR? 要在 Azure Docker 容器上配置 IronOCR,您需要按照与其他 Docker 环境相同的步骤进行操作。使用 IronOcr NuGet 包,设置推荐的 Linux 发行版,并确保在您的 Dockerfile 中包含所有必要的依赖项。 在 Docker 中使用 .NET 5 设置 IronOCR 的步骤是什么? 在 Docker 中使用 .NET 5 设置 IronOCR,您需要创建一个 Dockerfile 安装 IronOcr NuGet 包,添加所需的包如 apt-utils 和 libgdiplus,并使用微软的官方 .NET 5 Docker 镜像作为基础镜像。 IronOCR 能否在 Windows 的 Docker 环境中使用? 是的,可以在 Windows 的 Docker 环境中使用 IronOCR。此过程涉及使用 IronOcr NuGet 包并配置 Dockerfile 以包括必要的依赖项和针对 Windows 操作系统的配置。 使用 Docker 托管 .NET OCR 应用程序的好处是什么? 使用 Docker 托管 .NET OCR 应用程序可以实现轻松部署、更好的资源管理以及在不同环境中更大的可移植性。Docker 容器是自给自足的,确保应用程序无论在哪个环境中都能一致地运行。 Is manual configuration required for non-recommended Linux distributions in Docker? 是的,如果您使用推荐以外的 Linux 发行版(如 Ubuntu 20、Ubuntu 18、Debian 11、Debian 10),则可能需要使用 apt-get 进行手动配置。IronOCR 提供的“Linux 手动设置”指南提供了有关手动设置的指南。 Curtis Chau 立即与工程团队聊天 技术作家 Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。 准备开始了吗? Nuget 下载 5,167,857 | Version: 2025.11 刚刚发布 免费 NuGet 下载 总下载量:5,167,857 查看许可证