We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

.Net 6 Migration

Hi Team,

I am migrating my project to .Net 6 and below is the code I added in Dockerfile when I am using ASP.Net Core 3.1 for a successful build

Install GDI+ lib needed for Aspose.Cells

RUN apt-get update
RUN apt-get -y install libgdiplus

Now the same above command was running successfully in Docker Container when I used .Net Core 3.1 but when I migrated to .Net 6 it gives me the below error

Step 3/8 : RUN apt-get update
—> Running in 46c006fcc254
e[91m/bin/sh: apt-get: not found
e[0mThe command ‘/bin/sh -c apt-get update’ returned a non-zero code: 127

Ensure that MS fonts are available, needed for PDF generation with Aspose.

RUN sed -i’.bak’ ‘s/$/ contrib/’ /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y fontconfig ttf-mscorefonts-installer
RUN fc-cache -vfs

I can see above commands as well in my Dockerfile for MS fonts needed for PDF Generation.

Is there any alternate command I need to use for .Net 6 in Dockerfile

Hi @mohammedatif.shamim
Attached is a copy of the Dockerfile that I tested and passed, please refer to.Dockerfile.zip (639 Bytes)

Hi @leoluo

I made the changes as per the attached Dockerfile but it’s getting failed again with below error

Step 3/5 : RUN apt-get update && apt-get install -y --allow-unauthenticated libc6-dev libgdiplus libx11-dev && rm -rf /var/lib/apt/lists/*
—> Running in f4020499fc61
e[91m/bin/sh: apt-get: not found
e[0mThe command ‘/bin/sh -c apt-get update && apt-get install -y --allow-unauthenticated libc6-dev libgdiplus libx11-dev && rm -rf /var/lib/apt/lists/*’ returned a non-zero code: 127

Hi @mohammedatif.shamim
I test in my docker project using above Dockerfile, and find no errors.
Would you please share your whole Dockerfile here, I will check it in my environment.

Hi @leoluo

PFB the Dockerfile content

FROM some.private.docker.repo.to.fetch.dotnet6.build.image

Of course, need to switch to ‘root’ before running the below commands

USER root

Install GDI+ lib needed for Aspose.Cells

RUN apt-get update
&& apt-get install -y --allow-unauthenticated
libc6-dev
libgdiplus
libx11-dev
&& rm -rf /var/lib/apt/lists/*

Ensure that MS fonts are available, needed for PDF generation with Aspose.

RUN apt-get update; apt-get install -y fontconfig fonts-liberation
RUN fc-cache -f -v

I believe the issue is due to the Alpine Docker Build Image used as when I replaced “apt-get update;” with “apk update” then I didn’t get any error but now the error comes related to finding libgdiplus library using apk command. Therefore please let me know how I can install GDI+ lib needed for Aspose.Cells using apk command

install (no such package):
e[91mERROR: unable to select packages:
e[0m required by: world[install]
libc6-dev (no such package):
required by: world[libc6-dev]
libgdiplus (no such package):
required by: world[libgdiplus]
The command ‘/bin/sh -c apk update && apk add install libc6-dev libgdiplus libx11-dev && rm -rf /var/lib/apt/lists/*’ returned a non-zero code: 3

@mohammedatif.shamim,

Thanks for sharing docker file contents and further details.

We will be looking into it and get back to you soon.

Hi @mohammedatif.shamim
Is your Docker based on Alpine?
Please refer to Microsoft official document: Install .NET on Alpine - .NET | Microsoft Docs

You may use the following command to install net6 dependencies and libgdiplus:
Let us know your feed back. Thank you.

apk add bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib

apk add libgdiplus --repository https://dl-3.alpinelinux.org/alpine/edge/testing/

Hi @mohammedatif.shamim
libgdiplus is not working well in linux. We have migrated the graphics library to SkiaSharp for linux.
We suggest using .NET6 and Aspose.Cells 22.10.1 or later, See reference documentation:


In this document, you can get the example dockerfile for linux(such as Ubuntu and Alpine).
With the new release, you can use SkiaSharp on linux, and choose SkiaSharp or System.Drawing.Common on windows.