Open BharatRajMeriyala opened 6 years ago
I am not sure its possible to create a symlink in docker container.
https://stackoverflow.com/questions/31881904/docker-follow-symlink-outside-context
And I updated my docker file like below, I still get the same error. I am using Ubuntu 16.04 in my production environment.
FROM microsoft/aspnetcore-build:2.0
RUN apt-get update RUN apt-get install -y libgdiplus
RUN npm install typings -g
RUN ln -s /lib64/libdl.so.2 /lib64/libdl.so
COPY . /app WORKDIR /app/MyWeb
RUN ["dotnet", "--info"] RUN ["dotnet", "restore"]
EXPOSE 5000/tcp ENV ASPNETCORE_URLS http://*:5000
RUN ["dotnet", "publish"]
WORKDIR /app/MyWeb/bin/Debug/netcoreapp2.0/publish
ENTRYPOINT ["dotnet", "MyWeb.dll"]
I also have some problem. use ln -s /lib64/libdl.so.2 /lib64/libdl.so , But it doesn't work in the Docker , I am using Centos 7.3 64bit
Revert to v1.5.2 which uses CoreCompat.System.Drawing.v2
for now. v1.5.4 uses Microsoft's System.Drawing.Common
library. It's in the preview phase right now.
Install-Package EPPlus.Core -Version 1.5.2
Also you need to install libgdiplus too.
For Ubuntu 16.04 and above:
apt-get install libgdiplus
cd /usr/lib
ln -s libgdiplus.so gdiplus.dll
when I run install libgdiplus ,I only find libgdiplus.so.0 in /usr/lib64, not find libgdiplus.so ,then I run cd /usr/lib64 ln -s libgdiplus.so.0 gdiplus.dll, but it also dosen't work I am using Centos 7.3 64bit
For CentOS 7 and above:
yum install autoconf automake libtool
yum install freetype-devel fontconfig libXft-devel
yum install libjpeg-turbo-devel libpng-devel giflib-devel libtiff-devel libexif-devel
yum install glib2-devel cairo-devel
git clone https://github.com/mono/libgdiplus
cd libgdiplus
./autogen.sh
make
make install
cd /usr/lib64/
ln -s /usr/local/lib/libgdiplus.so gdiplus.dll
why the command yum install libgdiplus dosen't work,must execute the commands you write
I did it according to what you said
root@izuf6fv1dbvhuu4bilrjg5z:~# find / -name libgdiplus.so
/usr/local/lib/libgdiplus.so
/root/libgdiplus/src/.libs/libgdiplus.so
root@izuf6fv1dbvhuu4bilrjg5z:~# find / -name gdiplus.dll
/usr/lib64/gdiplus.dll
but the excption is also existence The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'gdiplus': The specified module or one of its dependencies could not be found.
I according to http://www.mono-project.com/docs/advanced/pinvoke/dllnotfoundexception/ I slove this problem thank for VahidN
The only way i was able to work around this issue was by reverting to v1.5.2 and adding the following symlink: ln -s libgdiplus.so gdiplus.dll
to my Docker image
Thanks @VahidN
If you are using 1.5.4, update your System.Drawing.Common
dependency. This official package has 3 updates now:
https://www.nuget.org/packages/System.Drawing.Common/
About Unable to load DLL 'libdl'
error in containers, they are suggesting:
libgdiplus
and libc6-dev
in your container (If you're on Ubuntu or Debian, you can try to install the libc6-dev
package to get libdl.so
)./usr/lib/x86_64-linux-gnu/libdl.so
file exists inside your container.LD_LIBRARY_PATH
to $LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu
but that should be included already.LD_DEBUG
environment variable to libs
in your Dockerfile, restart your container. FROM microsoft/aspnetcore RUN apt-get update RUN apt-get install -y apt-utils RUN apt-get install -y libgdiplus RUN ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll WORKDIR /app COPY /app ./ EXPOSE 8082 ENTRYPOINT ["dotnet", "WebApp.dll"]
is ok
samples: dotnet-ascpnetcore-runtime:2.1 xx.csproj file: Dockerfile file: or directly use the images i had buit: https://hub.docker.com/r/justmine/dotnet-aspnetcore-runtime-gdiplus it is ok !!! 亲测可用
@justmine66 It works for me, but package lsof may be unnecessary, and make symbol link for gidplus.dll is also unnecessary.
FROM microsoft/dotnet:2.1-aspnetcore-runtime
WORKDIR /app
COPY ./EPPlusOnDocker .
RUN apt-get update \
&& apt-get install -y --no-install-recommends libgdiplus libc6-dev \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT [ "dotnet", "EPPlusOnDocker.dll" ]
I am trying to generate the excel sheet, using EPPlus.Core in dotnet core 2.0 framework. The generation works fine on local machine running windows. When I test the same on Ubuntu docker images, it fails with the below exception:
Unable to load DLL 'libdl': The specified module or one of its dependencies could not be found. (Exception from HRESULT: 0x8007007E) at Interop.Libdl.dlopen(String fileName, Int32 flag) at System.Drawing.SafeNativeMethods.Gdip.LoadNativeLibrary() at System.Drawing.SafeNativeMethods.Gdip..cctor()
The same used to work fine when I used the dotnet core 1.1, with libgdiplus being explicitely installed. But this setup fails with dotnet core 2.0.
The complete docker file is as below:
FROM microsoft/aspnetcore-build:2.0
RUN apt-get update RUN apt-get install -y libgdiplus
RUN npm install typings -g
COPY . /app WORKDIR /app/MyWeb
RUN ["dotnet", "--info"] RUN ["dotnet", "restore"]
EXPOSE 5000/tcp ENV ASPNETCORE_URLS http://*:5000
RUN ["dotnet", "publish"]
WORKDIR /app/MyWeb/bin/Debug/netcoreapp2.0/publish
ENTRYPOINT ["dotnet", "MyWeb.dll"]