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
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.
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
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.