Unable to load shared library "libgdiplus" - Docker [ .NET application with Aspose API] Unable to load shared library "libgdiplus" - Docker [ .NET application with Aspose API] docker docker

Unable to load shared library "libgdiplus" - Docker [ .NET application with Aspose API]


You're installing libgdiplus in your build container image, but not in your final container image. You need to make sure libgdiplus is installed in your final container image.

You can consider amending your Dockerfile like this:

FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS baseRUN apt-get update && apt-get install -y libgdiplusWORKDIR /appFROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build[...]


Here is how you can build a custom docker image to handle this problem in dotnetcore 2.2:

I had to use this process to add all of the necessary libraries to my container so that it would work with system.drawing. This may have to be updated for 3.1. I'm actually working on this today for 3.1 so i'll provide any updated instructions as I find them:

1) docker pull ubuntu

2) docker run -t ubuntu:latest /bin/bash -> to open a container shell ->

3) apt-get update apt

4) apt-get install wget

5) wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

6) dpkg -i packages-microsoft-prod.deb

7) apt-get install apt-transport-https

8) apt-get update

9) apt-get install dotnet-sdk-2.2 <---- this will need to change for sure

10) apt-get install libgdiplus

11) cd /usr/lib

12) ln -s libgdiplus.so gdiplus.dll

13) apt-get install libc6-dev libx11-dev

14) rm -rf /var/lib/apt/lists/*