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 IronPDF Engine tutorials guide.

Docker V1 related to Adding IronPDF to an Existing Docker Container
Azure 1 related to Adding IronPDF to an Existing Docker Container
Linux V1 related to Adding IronPDF to an Existing Docker Container
Amazon Web Services V1 related to Adding IronPDF to an Existing Docker Container
Windows Logo V1 related to Adding IronPDF to an Existing Docker Container

Why use Docker on Azure?

Alongside excellent enterprise scalability, Docker Containers on Azure enjoyed more permissions than regular WebApps.
This allows rendering of SVG fonts, because system access to GDI+ graphics are 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 using apt-get. See our "Linux Manual Setup" guide

Working Docker files for Ubuntu and Debian are included in this document:

IronPDF Linux Docker Installation Essentials

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 false. That is because the prerequisites are already installed by apt-get style package managers already in your Docker files.

IronPdf.Installation.LinuxAndDockerDependenciesAutoConfig = false;

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:

IronPdf.Installation.ChromeGpuMode=IronPdf.Engines.Chrome.ChromeGpuModes.Disabled;

"Ahead of Time" Initialization

Optionally, you may also wish to call the IronPdf.Installation.Initialize() method to manually start IronPDF. The very first time a Docker instance uses IronPDF, it may take some time to download prerequisites. We can avoid that scenario by calling this code when the instance is created:

IronPdf.Installation.Initialize();

Ubuntu Linux DockerFiles

Docker V1 related to Ubuntu Linux DockerFiles
Ubuntu V1 related to Ubuntu Linux DockerFiles

Ubuntu 22 with .NET 8

Please change the user from 'app' to 'root'. This will ensure that sufficient permissions are granted to the library. With this change, it will not be necessary to set 'rwx' for the IronCefSubprocess.

# base image (Ubuntu 22)
FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy
USER root
WORKDIR /app
# install necessary packages
RUN apt update \
&& apt install -y sudo libxkbcommon-x11-0 libc6 libc6-dev libgtk2.0-0 libnss3 libatk-bridge2.0-0 libx11-xcb1 libxcb-dri3-0 libdrm-common libgbm1 libasound2 libxrender1 libfontconfig1 libxshmfence1 libgdiplus libva-dev
# restore NuGet packages
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "./Example/./Example.csproj"
# build project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "./Example.csproj" -c $BUILD_CONFIGURATION -o /app/build
# publish project
RUN dotnet publish "./Example.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
WORKDIR /app/publish
# run app
ENTRYPOINT ["dotnet", "Example.dll"]

Ubuntu 22 with .NET 7

# base image (Ubuntu 22)
FROM mcr.microsoft.com/dotnet/sdk:7.0-jammy
WORKDIR /src
# install necessary packages
RUN apt update \
&& apt install -y sudo libc6 libc6-dev libgtk2.0-0 libnss3 libatk-bridge2.0-0 libx11-xcb1 libxcb-dri3-0 libdrm-common libgbm1 libasound2 libxrender1 libfontconfig1 libxshmfence1 libxkbcommon-dev libgdiplus
# restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"
# build project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build
# publish project
RUN dotnet publish "Example.csproj" -c Release -o /app/publish
WORKDIR /app/publish
# update permissions
RUN chmod 775 /app/publish/runtimes/linux-x64/native/IronCefSubprocess
# run app
ENTRYPOINT ["dotnet", "Example.dll"]

Ubuntu 20 with .NET 6

# base image (Ubuntu 20)
FROM mcr.microsoft.com/dotnet/sdk:6.0-focal
WORKDIR /src
# install necessary packages
RUN apt update \
&& apt install -y libc6 libc6-dev libgtk2.0-0 libnss3 libatk-bridge2.0-0 libx11-xcb1 libxcb-dri3-0 libdrm-common libgbm1 libasound2 libappindicator3-1 libxrender1 libfontconfig1 libxshmfence1 libgdiplus libva-dev
# restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"
# build project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build
# publish project
RUN dotnet publish "Example.csproj" -c Release -o /app/publish
WORKDIR /app/publish
# update permissions
RUN chmod 775 /app/publish/runtimes/linux-x64/native/IronCefSubprocess
# run app
ENTRYPOINT ["dotnet", "Example.dll"]

Ubuntu 20 with .NET 5

# base image (Ubuntu 20)
FROM mcr.microsoft.com/dotnet/sdk:5.0-focal
WORKDIR /src
# install necessary packages
RUN apt update \
&& apt install -y libc6 libc6-dev libgtk2.0-0 libnss3 libatk-bridge2.0-0 libx11-xcb1 libxcb-dri3-0 libdrm-common libgbm1 libasound2 libappindicator3-1 libxrender1 libfontconfig1 libxshmfence1 libgdiplus libva-dev
# restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"
# build project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build
# publish project
RUN dotnet publish "Example.csproj" -c Release -o /app/publish
WORKDIR /app/publish
# update permissions
RUN chmod 775 /app/publish/runtimes/linux-x64/native/IronCefSubprocess
# run app
ENTRYPOINT ["dotnet", "Example.dll"]

Ubuntu 20 with .NET 3.1 LTS

# base image (Ubuntu 20)
FROM mcr.microsoft.com/dotnet/sdk:3.1-focal
WORKDIR /src
# install necessary packages
RUN apt update \
&& apt install -y libc6 libc6-dev libgtk2.0-0 libnss3 libatk-bridge2.0-0 libx11-xcb1 libxcb-dri3-0 libdrm-common libgbm1 libasound2 libappindicator3-1 libxrender1 libfontconfig1 libxshmfence1 libgdiplus libva-dev
# restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"
# build project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build
# publish project
RUN dotnet publish "Example.csproj" -c Release -o /app/publish
WORKDIR /app/publish
# update permissions
RUN chmod 775 /app/publish/runtimes/linux-x64/native/IronCefSubprocess
# run app
ENTRYPOINT ["dotnet", "Example.dll"]

Ubuntu 18 with .NET 3.1 LTS

# base image (Ubuntu 18)
FROM mcr.microsoft.com/dotnet/sdk:3.1-bionic
WORKDIR /src
# install necessary packages
RUN apt update \
&& apt install -y libc6 libc6-dev libgtk2.0-0 libnss3 libatk-bridge2.0-0 libx11-xcb1 libxcb-dri3-0 libdrm-common libgbm1 libasound2 libappindicator3-1 libxrender1 libfontconfig1 libxshmfence-dev libgdiplus libva-dev
# restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"
# build project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build
# publish project
RUN dotnet publish "Example.csproj" -c Release -o /app/publish
WORKDIR /app/publish
# update permissions
RUN chmod 775 /app/publish/runtimes/linux-x64/native/IronCefSubprocess
# run app
ENTRYPOINT ["dotnet", "Example.dll"]

Debian Linux DockerFiles

Docker V1 related to Debian Linux DockerFiles
Debian V1 related to Debian Linux DockerFiles

Debian 12 with .NET 8

# base image (Debian 12)
FROM mcr.microsoft.com/dotnet/sdk:8.0
USER root
WORKDIR /app
# install necessary packages
RUN apt update \
&& apt install -y sudo libxkbcommon-x11-0 libc6 libc6-dev libgtk2.0-0 libnss3 libatk-bridge2.0-0 libx11-xcb1 libxcb-dri3-0 libdrm-common libgbm1 libasound2 libxrender1 libfontconfig1 libxshmfence1 libgdiplus libva-dev
# restore NuGet packages
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "./Example/./Example.csproj"
# build project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "./Example.csproj" -c $BUILD_CONFIGURATION -o /app/build
# publish project
RUN dotnet publish "./Example.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
WORKDIR /app/publish
# run app
ENTRYPOINT ["dotnet", "Example.dll"]

Debian 11 with .NET 7

# base image (Debian 11)
FROM mcr.microsoft.com/dotnet/sdk:7.0
WORKDIR /src
# install necessary packages
RUN apt update \
&& apt install -y sudo libc6 libc6-dev libgtk2.0-0 libnss3 libatk-bridge2.0-0 libx11-xcb1 libdrm-common libgbm1 libasound2 libxrender1 libfontconfig1 libxshmfence1 libxkbcommon-dev libgdiplus libva-dev
# restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"
# build project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build
# publish project
RUN dotnet publish "Example.csproj" -c Release -o /app/publish
WORKDIR /app/publish
# update permissions
RUN chmod 775 /app/publish/runtimes/linux-x64/native/IronCefSubprocess
# run app
ENTRYPOINT ["dotnet", "Example.dll"]

Debian 11 with .NET 6

# base image (Debian 11)
FROM mcr.microsoft.com/dotnet/sdk:6.0
WORKDIR /src
# install necessary packages
RUN apt update \
&& apt install -y sudo libxkbcommon-x11-0 libc6 libc6-dev libgtk2.0-0 libnss3 libatk-bridge2.0-0 libx11-xcb1 libxcb-dri3-0 libdrm-common libgbm1 libasound2 libxrender1 libfontconfig1 libxshmfence1 libgdiplus libva-dev
# restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"
# build project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build
# publish project
RUN dotnet publish "Example.csproj" -c Release -o /app/publish
WORKDIR /app/publish
# update permissions
RUN chmod 775 /app/publish/runtimes/linux-x64/native/IronCefSubprocess
# run app
ENTRYPOINT ["dotnet", "Example.dll"]

Debian 11 with .NET 5

# base image (Debian 11)
FROM mcr.microsoft.com/dotnet/sdk:5.0-bullseye-slim
WORKDIR /src
# install necessary packages
RUN apt update \
&& apt install -y sudo libxkbcommon-x11-0 libc6 libc6-dev libgtk2.0-0 libnss3 libatk-bridge2.0-0 libx11-xcb1 libxcb-dri3-0 libdrm-common libgbm1 libasound2 libxrender1 libfontconfig1 libxshmfence1 libgdiplus libva-dev
# restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"
# build project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build
# publish project
RUN dotnet publish "Example.csproj" -c Release -o /app/publish
WORKDIR /app/publish
# update permissions
RUN chmod 775 /app/publish/runtimes/linux-x64/native/IronCefSubprocess
# run app
ENTRYPOINT ["dotnet", "Example.dll"]

Debian 11 with .NET 3.1 LTS

# base image (Debian 11)
FROM mcr.microsoft.com/dotnet/sdk:3.1-bullseye
WORKDIR /src
# install necessary packages
RUN apt update \
&& apt install -y sudo libxkbcommon-x11-0 libc6 libc6-dev libgtk2.0-0 libnss3 libatk-bridge2.0-0 libx11-xcb1 libxcb-dri3-0 libdrm-common libgbm1 libasound2 libxrender1 libfontconfig1 libxshmfence1 libgdiplus libva-dev
# restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"
# build project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build
# publish project
RUN dotnet publish "Example.csproj" -c Release -o /app/publish
WORKDIR /app/publish
# update permissions
RUN chmod 775 /app/publish/runtimes/linux-x64/native/IronCefSubprocess
# run app
ENTRYPOINT ["dotnet", "Example.dll"]

Debian 10 with .NET 5

# base image (Debian 10)
FROM mcr.microsoft.com/dotnet/sdk:5.0
WORKDIR /src
# install necessary packages
RUN apt update \
&& apt install -y libc6 libc6-dev libgtk2.0-0 libnss3 libatk-bridge2.0-0 libx11-xcb1 libxcb-dri3-0 libdrm-common libgbm1 libasound2 libappindicator3-1 libxrender1 libfontconfig1 libxshmfence1 libgdiplus libva-dev
# restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"
# build project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build
# publish project
RUN dotnet publish "Example.csproj" -c Release -o /app/publish
WORKDIR /app/publish
# update permissions
RUN chmod 775 /app/publish/runtimes/linux-x64/native/IronCefSubprocess
# run app
ENTRYPOINT ["dotnet", "Example.dll"]

Debian 10 with .NET 3.1 LTS

# base image (Debian 10)
FROM mcr.microsoft.com/dotnet/sdk:3.1
WORKDIR /src
# install necessary packages
RUN apt update \
&& apt install -y libc6 libc6-dev libgtk2.0-0 libnss3 libatk-bridge2.0-0 libx11-xcb1 libxcb-dri3-0 libdrm-common libgbm1 libasound2 libappindicator3-1 libxrender1 libfontconfig1 libxshmfence1 libgdiplus libva-dev
# restore NuGet packages
COPY ["Example/Example.csproj", "Example/"]
RUN dotnet restore "Example/Example.csproj"
# build project
COPY . .
WORKDIR "/src/Example"
RUN dotnet build "Example.csproj" -c Release -o /app/build
# publish project
RUN dotnet publish "Example.csproj" -c Release -o /app/publish
WORKDIR /app/publish
# update permissions
RUN chmod 775 /app/publish/runtimes/linux-x64/native/IronCefSubprocess
# run app
ENTRYPOINT ["dotnet", "Example.dll"]

Alpine Linux DockerFiles

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 IronPdf functionalities by connecting to an 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:

docker pull ironsoftwareofficial/ironpdfengine
docker run -d -p 33350:33350 ironsoftwareofficial/ironpdfengine

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.

IronPDF Windows Docker Containers

Docker V1 related to IronPDF Windows Docker Containers
Windows Logo V1 related to IronPDF Windows Docker Containers

Windows Docker Containers are becoming increasingly 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.

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

# escape=`
FROM mcr.microsoft.com/windows/servercore:ltsc2016 AS baseOS
RUN powershell -Command [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -UseBasicParsing -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1; ./dotnet-install.ps1 -InstallDir '/Program Files/dotnet' -Channel 3.1 -Runtime dotnet; Remove-Item -Force dotnet-install.ps1 && setx /M PATH "%PATH%;C:\Program Files\dotnet"
COPY . .
FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base

Windows Server 2019 .NET 6.0

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

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

FROM mcr.microsoft.com/dotnet/sdk:6.0-windowsservercore-ltsc2019 AS build
WORKDIR /src
COPY ["nuget.config", "."]
COPY ["ConsoleApp/ConsoleApp.csproj", "ConsoleApp/"]
RUN dotnet restore "ConsoleApp/ConsoleApp.csproj"
COPY . .
WORKDIR "/src/ConsoleApp"
RUN dotnet build "ConsoleApp.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "ConsoleApp.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM ironsoftwareofficial/windows:2019-net60
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ConsoleApp.dll"]

Visit the IronSoftware's Docker repository on Docker Hub to explore additional pre-configured images for running IronPdf.