Setting up IronXL in Docker Containers
Want to Read, edit & create Excel spreadsheet files Using C#?
IronXL now fully supports Docker, including Azure Docker Containers for Linux and Windows.
Why use Docker?
Docker enables developers to easily pack, ship, and run any application as a lightweight, portable, self-sufficient container, which can run virtually anywhere.
IronXL 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. https://docs.microsoft.com/en-us/visualstudio/containers/edit-and-refresh?view=vs-2019
We also highly recommend you read our IronXL Linux Setup and Compatibility Guide
Recommended Linux Docker Distributions
We recommend the latest 64-bit Linux OS's below for "easy configuration" of IronXL, matching the distros Microsoft currently ships official .NET 8 container images for:
- Ubuntu 24.04 (Noble)
- Ubuntu 22.04 (Jammy)
- Debian 12 (Bookworm) [Current Microsoft Azure default Linux distro]
- RHEL / UBI 8 or 9 (for RHEL-family deployments — see below; Microsoft no longer publishes official CentOS runtime images)
We recommend using Microsoft's Official Docker Images. 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, Debian, and RHEL/UBI are included in this document:
IronXL Linux Docker Installation Essentials
Use Our NuGet Package
We recommend using the IronXL NuGet Package. It works when developing on Windows, macOS, and Linux.
Install-Package IronXL.Excel
Ubuntu Linux DockerFiles
Ubuntu 24.04 (Noble) with .NET 8 LTS
# Base runtime image (Ubuntu 24.04 with .NET runtime)
FROM mcr.microsoft.com/dotnet/runtime:8.0-noble AS base
WORKDIR /app
# Base development image (Ubuntu 24.04 with .NET SDK)
FROM mcr.microsoft.com/dotnet/sdk:8.0-noble AS build
WORKDIR /src
# 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
FROM build AS publish
RUN dotnet publish "Example.csproj" -c Release -o /app/publish
# Run app
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Example.dll"]
Ubuntu 22.04 (Jammy) with .NET 8 LTS
# Base runtime image (Ubuntu 22.04 with .NET runtime)
FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy AS base
WORKDIR /app
# Base development image (Ubuntu 22.04 with .NET SDK)
FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build
WORKDIR /src
# 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
FROM build AS publish
RUN dotnet publish "Example.csproj" -c Release -o /app/publish
# Run app
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Example.dll"]
Debian Linux DockerFiles
Debian 12 (Bookworm) with .NET 8 LTS
# Base runtime image (Debian 12 with .NET runtime)
FROM mcr.microsoft.com/dotnet/runtime:8.0-bookworm-slim AS base
WORKDIR /app
# Base development image (Debian 12 with .NET SDK)
FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build
WORKDIR /src
# 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
FROM build AS publish
RUN dotnet publish "Example.csproj" -c Release -o /app/publish
# Run app
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Example.dll"]
RHEL / UBI DockerFiles
Microsoft no longer publishes official CentOS runtime images (CentOS 7 and 8 are both end-of-life). For RHEL-family deployments, use Red Hat's own Universal Base Image (UBI) .NET containers instead — they're freely usable without a Red Hat subscription and are kept current with supported .NET releases.
RHEL UBI 8 with .NET 8 LTS
# Base runtime image (UBI 8 with .NET 8 runtime)
FROM registry.access.redhat.com/ubi8/dotnet-80-runtime:8.0 AS base
WORKDIR /app
# Base development image (UBI 8 with .NET 8 SDK)
FROM registry.access.redhat.com/ubi8/dotnet-80:8.0 AS build
WORKDIR /src
# 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
FROM build AS publish
RUN dotnet publish "Example.csproj" -c Release -o /app/publish
# Run app
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Example.dll"]Frequently Asked Questions
How can I set up IronXL in a Docker container?
To set up IronXL in a Docker container, you need to use the IronXL NuGet package, which is compatible with Windows, macOS, and Linux. Install it using the command: dotnet add package IronXL. For Docker, integrate the package in your Dockerfile and ensure your application can access the necessary libraries and dependencies.
What are the benefits of using Docker for Excel applications?
Docker allows you to package, ship, and run Excel applications as lightweight, portable containers, ensuring consistency and efficiency across different environments. This helps in maintaining a stable and reproducible development and production environment.
Which Linux distributions work best with IronXL in Docker?
The recommended Linux distributions for configuring IronXL in Docker are Ubuntu 24.04, Ubuntu 22.04, Debian 12, and RHEL/UBI 8 or 9. These are the distributions Microsoft currently ships official .NET 8 container images for, providing a stable environment for Docker containers running Excel applications.
Can I use IronXL in both Windows and Linux Docker containers?
Yes, IronXL supports Docker containers on both Windows and Linux platforms. This includes containers hosted on Azure, allowing for flexible deployment options.
What Docker images are recommended for .NET applications using IronXL?
For .NET applications using IronXL, it is recommended to use Microsoft's official Docker images for .NET runtime and SDK. These images are optimized for .NET applications and can be found on Docker Hub.
How can I troubleshoot issues with IronXL in a Docker environment?
If you encounter issues with IronXL in Docker, ensure all dependencies are correctly installed within your Docker container. Check your Dockerfile configuration and ensure the correct .NET version is being used. Refer to the IronXL documentation and Docker's official troubleshooting guides for more help.
What resources are available for learning more about Docker and IronXL integration?
For further learning on Docker and IronXL integration, refer to Microsoft's documentation on Docker for .NET and Visual Studio projects. Additionally, IronXL’s Linux setup guide provides valuable information for setting up Docker environments.

