如何拉取並運行 IronPdfEngine
從 Dockerhub、AWS ECR 公共庫或 AWS 市場中提取並運行 IronPdfEngine 映像,涉及提取預建容器映像,然後在 Docker 環境中執行它。
拉取:這是指從指定註冊處檢索IronPdfEngine容器映像(Dockerhub、AWS ECR Public Gallery 或 AWS Marketplace)到您的本地系統。 docker pull 命令通常用於此目的。
運行:一旦拉取了映像,您就可以使用 docker run 命令來基於該映像啟動容器實例。 這會在 Docker 容器內啟動 IronPdfEngine 應用程序,讓您可以利用其功能。
開始使用 IronPDF
立即在您的專案中使用IronPDF,並享受免費試用。
如何拉取並運行 IronPdfEngine
- 從您首選的註冊表中拉取預構建容器映像
- 運行映像並暴露其功能以便使用
- 從Dockerhub獲取IronPdfEngine
- 從 AWS ECR 公共畫廊獲取 IronPdfEngine
- 從 AWS Marketplace 獲取 IronPdfEngine
在Dockerhub中獲取IronPdfEngine
先決條件
- Docker 必須安裝。
設置
前往 https://hub.docker.com/r/ironsoftwareofficial/ironpdfengine
- 拉取 ironsoftwareofficial/ironpdfengine 映像
docker pull ironsoftwareofficial/ironpdfengine
或拉取特定版本(推薦)
docker pull ironsoftwareofficial/ironpdfengine:2023.12.6
運行 ironsoftwareofficial/ironpdfengine 容器。
此命令將創建一個容器並在後台運行,使用端口 33350。
docker run -d -p 33350:33350 ironsoftwareofficial/ironpdfengine
學習如何配置IronPdf客戶端以利用IronPdfEngine,請導航至"將代碼更新為使用IronPdfEngine.
IronPdfEngine 在 Docker compose 內
關鍵在於設置一個 Docker 網絡,使 IronPdfEngine 和您的應用程序可以相互看見。 將 'depends_on' 設定為確保 IronPdfEngine 啟動之前您的應用程式已經啟動。
設置
- 首先創建一個
docker-compose.yml
文件。使用以下模板設置您的 Docker Compose 文件:
version: "3.6"
services:
myironpdfengine:
container_name: ironpdfengine
image: ironsoftwareofficial/ironpdfengine:latest
ports:
- "33350:33350"
networks:
- ironpdf-network
myconsoleapp:
container_name: myconsoleapp
build:
# enter YOUR project directory path here
context: ./MyConsoleApp/
# enter YOUR dockerfile name here, relative to project directory
dockerfile: Dockerfile
networks:
- ironpdf-network
depends_on:
myironpdfengine:
condition: service_started
networks:
ironpdf-network:
driver: "bridge"
在您的應用程序中設置 IronPdfEngine 的地址(myconsoleapp)"myironpdfengine:33350"
- 執行 docker compose
docker compose up --detach --force-recreate --remove-orphans --timestamps
在 AWS ECR 公共圖庫中獲取 IronPdfEngine
先決條件
- Docker 必須安裝。
設置
- 拉取 v1m9w8y1/ironpdfengine 映像
docker pull https://gallery.ecr.aws/v1m9w8y1/ironpdfengine
或拉取特定版本(推薦)
docker pull https://gallery.ecr.aws/v1m9w8y1/ironpdfengine:2023.12.6
运行 ironpdfengine 容器。
此命令將創建一個容器並在後台運行,端口為33350。
docker run -d -p 33350:33350 ironsoftwareofficial/ironpdfengine
學習如何配置IronPdf客戶端以利用IronPdfEngine,請導航至"將代碼更新為使用IronPdfEngine.
在 AWS Marketplace 獲取 IronPdfEngine
先決條件
- Docker 必須安裝。
- AWS CLI 必須安裝並登入。
設置
前往IronPdfEngine 在 AWS 市場. 點擊「繼續訂閱」。
接受條款。
繼續配置。
- 拉取 ironpdfengine 映像檔。 此步驟將向您展示拉取 ironpdfengine 映像的命令。
例如:
aws ecr get-login-password \
--region us-east-1
docker login \
--username AWS \
--password-stdin 000000000000.dkr.ecr.us-east-1.amazonaws.com
CONTAINER_IMAGES="000000000000.dkr.ecr.us-east-1.amazonaws.com/iron-software/ironpdfengine:2024.1.15"
for i in $(echo $CONTAINER_IMAGES
sed "s/,/ /g"); do docker pull $i; done
- 運行 ironpdfengine 容器。 此命令將創建一個容器並讓其在背景中運行,使用端口33350。
docker run -d -p 33350:33350 000000000000.dkr.ecr.us-east-1.amazonaws.com/iron-software/ironpdfengine:2024.1.15
在 Azure 市場獲取 IronPdfEngine
設置
前往IronPDF Docker 容器在 Azure 市場上. 點擊“立即獲取”和“繼續”。
完成「基本資料」、「叢集詳情」和「應用程式詳情」以建立 Kubernetes 服務。
- 部署完成後,在左側的側邊欄中,前往 Kubernetes 資源 -> 執行命令。 運行以下命令:
kubectl get services

使用 EXTERNAL-IP 和 PORT 的資訊(S),您可以相應地配置 IronPDFEngine 連接。
:path=/static-assets/pdf/content-code-examples/how-to/pull-run-ironpdfengine-azure-marketplace.cs
using IronPdf;
using IronPdf.GrpcLayer;
IronPdf.License.LicenseKey = "IRONPDF-MYLICENSE-KEY-1EF01";
IronPdfConnectionConfiguration configuration = new IronPdfConnectionConfiguration();
configuration.ConnectionType = IronPdfConnectionType.RemoteServer;
configuration.Host = "http://48.216.143.233";
configuration.Port = 80;
IronPdf.Installation.ConnectToIronPdfHost(configuration);
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>testing</h1>");
pdf.SaveAs("output.pdf");
Imports IronPdf
Imports IronPdf.GrpcLayer
IronPdf.License.LicenseKey = "IRONPDF-MYLICENSE-KEY-1EF01"
Dim configuration As New IronPdfConnectionConfiguration()
configuration.ConnectionType = IronPdfConnectionType.RemoteServer
configuration.Host = "http://48.216.143.233"
configuration.Port = 80
IronPdf.Installation.ConnectToIronPdfHost(configuration)
Dim renderer As New ChromePdfRenderer()
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>testing</h1>")
pdf.SaveAs("output.pdf")
將代碼更新為使用IronPdfEngine
這涉及修改代碼以確保 IronPdf 指向 IronPdfEngine 所公開的正確端口。這項操作對每種程式語言略有不同。 請參考以下文章以獲取具體使用說明:
此外,您可以將此容器部署在任何地方。 不要忘記開放33350端口,並確保IronPdf客戶端可以訪問。 要了解更多關於IronPdfEngine及其限制的信息,請訪問"IronPdfEngine 是什麼?" 文章。