Adding IronPDF to an Existing Docker Container

IronPDF for .NET Standard now fully supports Docker, including Azure Docker Containers for Linux and Windows.

Do you want to deploy IronPDF as a separate Docker container instead? Learn more about the IronPDFEngine tutorials guide.

Docker Logo
Azure Logo
Linux Logo
AWS Logo
Windows Logo

Why use Docker on Azure?

Alongside excellent enterprise scalability, Docker Containers on Azure enjoy more permissions than regular WebApps. This allows rendering of SVG fonts because system access to GDI+ graphics is enabled.

IronPDF and Linux Primer

If Docker with .NET is new to you, we recommend this excellent article on setting up Docker debugging and integration with Visual Studio projects.

We also highly recommend you read our IronPDF Linux Setup and Compatibility Guide

We recommend the latest 64-bit Linux OS's below for "easy configuration" of IronPDF.

We recommend using Microsoft's Official Docker Images for .NET. Other Linux distros are supported in part, but may require manual configuration. See our "Linux Manual Setup" guide.

IronPDF Linux Docker Installation

Use Linux Optimised NuGet Packages

We recommend using the IronPdf.Linux NuGet package instead of the regular IronPdf package to save disk space and avoid assets being downloaded when you start your Docker instance. Don't worry, it still works when developing on Windows or macOS - it is just Linux optimized.

Install-Package IronPdf.Linux

Another solution is to simply add IronPdf.Native.Chrome.Linux on top of the regular IronPdf NuGet package.

Install-Package IronPdf.Native.Chrome.Linux

Avoid Automatic Dependency Installation

Many users report better results with Linux & Docker when LinuxAndDockerDependenciesAutoConfig is set to false. This is because the prerequisites are already installed by apt-get style package managers in your Docker files.

// Disable automatic configuration of Linux and Docker dependencies
IronPdf.Installation.LinuxAndDockerDependenciesAutoConfig = false;
// Disable automatic configuration of Linux and Docker dependencies
IronPdf.Installation.LinuxAndDockerDependenciesAutoConfig = false;
' Disable automatic configuration of Linux and Docker dependencies
IronPdf.Installation.LinuxAndDockerDependenciesAutoConfig = False
$vbLabelText   $csharpLabel

Disable GPU Acceleration

Linux Docker containers often do not have access to a GPU. GPU acceleration is disabled by default. If you have enabled ChromeGpuModes.Enabled, we highly recommend you disable it for Docker deployments:

// Disable GPU acceleration for Docker environments
IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled;
// Disable GPU acceleration for Docker environments
IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled;
' Disable GPU acceleration for Docker environments
IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled
$vbLabelText   $csharpLabel

Ubuntu Linux Docker Files

Docker Logo
Ubuntu Logo

Ubuntu 22 with .NET 8

Ubuntu 22 with .NET 7

Ubuntu 20 with .NET 6

Ubuntu 20 with .NET 5

Ubuntu 20 with .NET 3.1 LTS

Ubuntu 18 with .NET 3.1 LTS

Debian Linux Docker Files

Docker Logo
Debian Logo

Debian 12 with .NET 8

Debian 11 with .NET 7

Debian 11 with .NET 6

Debian 11 with .NET 5

Debian 11 with .NET 3.1 LTS

Debian 10 with .NET 5

Debian 10 with .NET 3.1 LTS

Alpine Linux Docker Files

Running IronPDF on Alpine Linux is not supported. We wish we could but we can't. Frankly, we like Alpine and hope this project continues and grows. As of 2023, Alpine still uses outdated "musl" C language libraries that do not allow chromium developers to fully support this OS yet.

Using Alpine Docker with IronPdfEngine in .NET 6

IronPDF provides a container image containing all IronPDF functionalities. This enables projects running on Alpine to access IronPD functionalities by connecting to the IronPdfEngine container.

Step 1: Pull and Run IronPDF Engine Docker Image

Execute the following commands in your terminal to pull and run the IronPDF Engine Docker image:

# Pull the IronPDF Engine Docker Image
docker pull ironsoftwareofficial/ironpdfengine
# Pull the IronPDF Engine Docker Image
docker pull ironsoftwareofficial/ironpdfengine
SHELL
# Run the IronPDF Engine Docker container
docker run -d -p 33350:33350 ironsoftwareofficial/ironpdfengine
# Run the IronPDF Engine Docker container
docker run -d -p 33350:33350 ironsoftwareofficial/ironpdfengine
SHELL

Step 2: Set Up Console App

Create a new console application targeting .NET 6. Install the IronPdf.Slim NuGet package using the NuGet Package Manager.

Windows Docker File

Docker Logo
Windows Logo

Windows Docker Containers are becoming increasingly popular on Azure, as they offer higher levels of performance and scalability and give developers more permissions to configure instances.

IronPDF will actually perform more attractive text rendering within a Docker container (Windows or Linux) on Azure due to higher levels of access to graphics library and the virtual graphics card.

The article 'Visual Studio Container Tools for Docker' is a really great get-started guide.

This is an example Windows container Dockerfile for .NET Core 3.1

Windows Server 2019 .NET 6.0

Pre-configured Windows containers include all the necessary dependencies for running IronPDF.

Please noteNote that these containers are not intended for BUILDING .NET applications, but rather for RUNNING them.

Visit the Docker repository to explore additional pre-configured images for running IronPDF.

Frequently Asked Questions

How can I integrate a .NET library for PDF generation into a Docker container?

You can integrate IronPDF, a .NET library for PDF generation, into a Docker container by using Microsoft's official Docker images and the IronPdf.Linux NuGet package for Linux, or pre-configured Windows Docker containers for Windows environments.

What are the benefits of using Docker containers for PDF manipulation on Azure?

Using Docker containers for PDF manipulation on Azure provides enhanced enterprise scalability and more permissions than regular WebApps. This setup is ideal for enabling advanced features such as SVG font rendering through GDI+ graphics access.

Which Linux distributions are most suitable for running a .NET PDF library in Docker?

The most suitable Linux distributions for running IronPDF in Docker include Ubuntu 18/20/22, Debian 10/11, CentOS 8, and Amazon AWS Linux 2, as they offer straightforward configuration and compatibility.

How can I optimize performance for a .NET PDF library in Linux Docker containers?

To optimize performance, use the IronPdf.Linux package, disable automatic dependency installation, and turn off GPU acceleration by configuring the IronPdf.Installation.ChromeGpuMode to IronPdf.Engines.Chrome.ChromeGpuModes.Disabled.

Can IronPDF run on Alpine Linux within a Docker container?

IronPDF does not natively support Alpine Linux due to incompatible 'musl' libraries. To use IronPDF on Alpine Linux, consider running it through an IronPdfEngine Docker container.

What is the purpose of using pre-configured Docker containers for a .NET library?

Pre-configured Docker containers provide all necessary dependencies to run IronPDF efficiently, ensuring high performance and scalability, particularly beneficial when deploying on platforms like Azure.

How can I configure a .NET PDF library for .NET applications in Docker?

You can configure IronPDF for .NET applications in Docker by integrating it with both Linux and Windows Docker containers, enabling robust PDF functionalities within microservices architecture.

What are the recommended setup steps for deploying a .NET library in Docker?

Recommended steps include using a Linux-optimized package like IronPdf.Linux, disabling automatic dependency installations, and pre-initializing IronPDF to prevent delays during runtime in Docker environments.

How do I set up a .NET PDF library in a Windows Server 2019 Docker container running .NET 6.0?

Set up a .NET PDF library in a Windows Server 2019 Docker container by using a pre-configured Dockerfile that includes all necessary dependencies and configurations for running IronPDF with .NET 6.0.

Why disable GPU acceleration in a Docker setup for a .NET library?

Disabling GPU acceleration for IronPDF in Docker can lead to smoother deployment and performance by avoiding potential graphics-related issues in environments where GPU resources are limited.

Chaknith Bin
Software Engineer
Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience.