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.

Docker Azure Linux Amazon 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

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

  • Ubuntu 20
  • Ubuntu 18
  • Debian 11
  • Debian 10 [Currently the Microsoft Azure Default Linux Distro]
  • CentOS 7
  • CentOS 8

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 and Debian 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

Docker Ubuntu

Ubuntu 20 with .NET 5

# Base runtime image (Ubuntu 20 with .NET runtime) FROM mcr.microsoft.com/dotnet/runtime:5.0-focal AS base WORKDIR /app # Base development image (Ubuntu 20 with .NET SDK) FROM mcr.microsoft.com/dotnet/sdk:5.0-focal 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 20 with .NET 3.1 LTS

# Base runtime image (Ubuntu 20 with .NET runtime) FROM mcr.microsoft.com/dotnet/runtime:3.1-focal AS base WORKDIR /app # Base development image (Ubuntu 20 with .NET SDK) FROM mcr.microsoft.com/dotnet/sdk:3.1-focal 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 18 with .NET 3.1 LTS

# Base runtime image (Ubuntu 18 with .NET runtime) FROM mcr.microsoft.com/dotnet/runtime:3.1-bionic AS base WORKDIR /app # Base development image (Ubuntu 18 with .NET SDK) FROM mcr.microsoft.com/dotnet/sdk:3.1-bionic 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 11 with .NET 5

# Base runtime image (Debian 10 with .NET runtime) FROM mcr.microsoft.com/dotnet/aspnet:5.0-bullseye-slim AS base WORKDIR /app # Base development image (Debian 10 with .NET SDK) FROM mcr.microsoft.com/dotnet/sdk:5.0-bullseye-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"]

Debian 11 with .NET 3.1 LTS

# Base runtime image (Debian 10 with .NET runtime) FROM mcr.microsoft.com/dotnet/aspnet:3.1-bullseye-slim AS base WORKDIR /app # Base development image (Debian 10 with .NET SDK) FROM mcr.microsoft.com/dotnet/sdk:3.1-bullseye-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"]

Debian 10 with .NET 5

# Base runtime image (Debian 10 with .NET runtime) FROM mcr.microsoft.com/dotnet/runtime:5.0 AS base WORKDIR /app # Base development image (Debian 10 with .NET SDK) FROM mcr.microsoft.com/dotnet/sdk:5.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"]

Debian 10 with .NET 3.1 LTS

# Base runtime image (Debian 10 with .NET runtime) FROM mcr.microsoft.com/dotnet/runtime:3.1 AS base WORKDIR /app # Base development image (Debian 10 with .NET SDK) FROM mcr.microsoft.com/dotnet/sdk:3.1 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"]

CentOS 7 with .NET 3.1 LTS

# Base runtime image (CentOS 7) FROM centos:7 AS base WORKDIR /app # Install necessary packages RUN yum install sudo -y RUN sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm RUN sudo yum install dotnet-sdk-3.1 -y RUN sudo yum install aspnetcore-runtime-3.1 -y RUN sudo yum install dotnet-runtime-3.1 -y RUN sudo yum update -y 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 base AS publish WORKDIR /src COPY . . 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"]

CentOS 8 with .NET 3.1 LTS

# Base runtime image (CentOS 8) FROM centos:8 AS base WORKDIR /app # Install necessary packages RUN yum install sudo -y RUN sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm RUN sudo yum install dotnet-sdk-3.1 -y RUN sudo yum install aspnetcore-runtime-3.1 -y RUN sudo yum install dotnet-runtime-3.1 -y RUN sudo yum update -y 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 base AS publish WORKDIR /src COPY . . 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

What is Docker support for Excel applications?

IronXL fully supports Docker, including Azure Docker Containers for Linux and Windows, enabling you to run Excel applications in a containerized environment.

Why should I use Docker?

Docker allows developers to pack, ship, and run applications as lightweight, portable containers that can operate virtually anywhere, ensuring consistency and efficiency across development and production environments.

Which Linux distributions are recommended for Excel applications in Docker?

The recommended Linux distributions for easy configuration of IronXL in Docker are Ubuntu 20, Ubuntu 18, Debian 11, Debian 10, CentOS 7, and CentOS 8.

How do I install Excel library in a Docker environment?

Use the IronXL NuGet package, which is compatible with development on Windows, macOS, and Linux. You can install it using the command: dotnet add package IronXL.

Are there specific Docker images recommended for .NET applications?

It is recommended to use Microsoft's official Docker images for .NET runtime and SDK, which can be found on Docker Hub.

Can I use Excel library with any Linux distribution in Docker?

While IronXL supports various Linux distributions, some may require manual configuration using apt-get or similar package managers. It is advisable to refer to the Linux Manual Setup guide for assistance.

Where can I find more information on setting up Docker with .NET?

For a comprehensive guide on setting up Docker with .NET, including integration with Visual Studio projects, refer to the article on Docker debugging and integration on Microsoft's documentation website.

Does the library support both Windows and Linux Docker containers?

Yes, IronXL supports Docker containers on both Windows and Linux, including those hosted on Azure.

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.