在Debian 10 (Buster)上部署IronPdf的故障排除

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

當使用Debian 10 (Buster)基礎映像為IronPDF部署構建Docker映像時,Docker構建在apt-get update步驟中因404錯誤而失敗。

0.648 Err:4 http://deb.debian.org/debian buster Release
0.648 404 Not Found [IP: 151.101.162.132 80]
0.657 Err:5 http://deb.debian.org/debian-security buster/updates Release
0.657 404 Not Found [IP: 151.101.162.132 80]
0.708 E: The repository 'http://deb.debian.org/debian buster Release' does not have a Release file.
0.708 E: The repository 'http://deb.debian.org/debian-security buster/updates Release' does not have a Release file.

Debian 10 (Buster)已達到生命週期終點。其倉庫已從apt-get update的Docker映像都會出現這些404錯誤。 錯誤並不是由IronPDF的依賴安裝命令本身引起的,而是缺少倉庫元資料所致。

解決方案

選項1:升級到Debian 12並使用.NET 8(建議)

將Dockerfile基礎映像遷移到mcr.microsoft.com/dotnet/aspnet:8.0或其他基於Debian 12的映像。 IronPDF完全支持Debian 12和.NET 8。請參閱IronPDF Docker指南以取得完整可運行的Docker文件。

選項2:在Dockerfile中將APT重定向到Debian存檔

archive.debian.org

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base

RUN sed -i 's|deb.debian.org|archive.debian.org|g' /etc/apt/sources.list \
    && sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list \
    && apt-get update \
    && apt-get install -y \
       libgobject-2.0-0 libglib2.0-0 libnss3 libatk1.0-0 libatk-bridge2.0-0 \
       libcups2 libxcomposite1 libxrandr2 libxdamage1 libxfixes3 \
       libxkbcommon0 libxshmfence1 libgbm1 libasound2 \
       libpangocairo-1.0-0 libpango-1.0-0 libgtk-3-0 \
       fonts-liberation ca-certificates \
    && rm -rf /var/lib/apt/lists/*

此方法適用於尚未能遷移到.NET 8的現有.NET Core 3.1部署。請注意,Debian 10不再接收任何安全補丁,因此遷移到Debian 12仍是建議的路徑。

Curtis Chau
技術作家

Curtis Chau擁有Carleton大學的電腦科學學士學位,專精於前端開發,擁有Node.js、TypeScript、JavaScript和React的專業知識。Curtis熱衷於建立直觀且美觀的使用者介面,喜愛使用現代框架並建立結構良好、視覺吸引力的手冊。

除了開發,Curtis對物聯網(IoT)有濃厚的興趣,探索創新的方法來整合硬體和軟體。在空閒時間,他喜歡玩遊戲和建立Discord機器人,結合他對技術的熱愛與創造力。

準備開始了嗎?
Nuget 下載 20,088,359 | 版本: 2026.7 剛剛發布
Still Scrolling Icon

還在捲動嗎?

想快速獲得證明嗎? PM > Install-Package IronPdf
執行範例 看您的HTML變成PDF。