Create PDF Files using C# in Docker with IronPDF

Want to create PDF files in C#? IronPDF for .NET Standard now fully supports Docker, including Azure Docker Containers for Linux and Windows.

Docker Containers on Azure in particular enjoyed more permissions than WebApps. This allows rendering of SVG fonts, because system access to GDI+ graphics are enabled.

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

IronPDF on Linux Docker Containers

IronPDF fully supports and is tested on x64 builds, Ubuntu 12+, Debian 8+, and recent CentOS.

IronPDF works 'out-of-the-box' on vanilla docker images, which you can find and learn more about here:

Example DockerFile for Linux

# escape=`
# Mount folder for an application

Newer .NET Core Runtime Versions

You can also use other versions of .NET Core runtime - for example, this will install an image for .NET hosting with Core 3.1 support.

# Mount folder for an application

Linux Package Prerequisites

When we deploy to Linux and Docker, we have to ensure that the instance has the relevant packages installed to support PDF rendering. These packages are often not present in minimalist Linux builds.

By default, IronPdf.Installation.LinuxAndDockerDependenciesAutoConfig is set true, and this will instruct IronPDF to install all needed assets onto your Linux Docker container.

IronPdf.Installation.LinuxAndDockerDependenciesAutoConfig = true;
IronPdf.Installation.LinuxAndDockerDependenciesAutoConfig = True
VB   C#

If your application does not have sufficient permissions, you can add the necessary prerequisites manually by adding these RUN ["apt-get"] lines to your Dockerfile. These are normally located at the top, second line, just after the first docker image is defined.

# FROM AS base
# After first docker image is defined - install all these dependencies

RUN ["apt-get", "update"]
RUN ["apt-get", "-y", "install", "libgdiplus"]
RUN ["apt-get", "-y", "install", "xvfb", "libfontconfig", "wkhtmltopdf"]
RUN ["apt-get", "-y", "install", "libc6-dev"]
RUN ["apt-get", "-y", "install", "openssl"]
RUN ["apt-get", "-y", "install", "libssl1.0-dev"]

You may also install by hand using apt-get, yum or similar - though this is less preferable for Docker.

sudo apt-get update
sudo apt-get install -y libgdiplus xvfb libfontconfig wkhtmltopdf libc6-dev openssl libssl1.0-dev

IronPDF Windows Docker Containers

Windows Docker Containers are becoming increaingly popular on Azure, as they give 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 because of higher levels of access to graphics library and the virtual graphics card.

Example DockerFile for Windows

This is an example Windows container Dockerfile for .NET Core 2.1 and .NET 4.0+ applications.

# escape=`

# Create folder for .NET Core installer
WORKDIR /dotnet-install

# Download .NET Core installer
ADD dotnet-installer.exe

# Execute .NET Core installer
USER ContainerAdministrator

RUN dotnet-installer.exe /install /quiet /norestart /log dotnet-install.log || exit 0

# Print installation log to the Console
USER ContainerUser

RUN type dotnet-install.log
# Mount application folder
VOLUME c:\app

Newer .NET Core Runtime Versions

You can also change the version to .NET 3.1 by changing to the below docker image. Find more at

# Download .NET Core installer
ADD dotnet-installer.exe

IronPDF + Docker Cloud Hosting

IronPDF within Docker containers can easily be deployed to cloud platforms including Amazon AWS, Heroku, Azure, Digital Ocean and many more.