netcore deployment docker exception - Picture two-dimensional code generation lack libdl

Recently because of operational requirements we need to achieve a two-dimensional picture in the program code is generated, so he used QRCoder development library. The final deployment no problem running in the windows environment, but after switching to the docker (centos7.0) found to be problematic.

错误信息提示:The type initializer for 'Gdip' threw an exception. Unable to load shared library 'libdl' or one of its dependencies.

As shown below:

 

By error analysis, docker container file is missing libdl lead to error.

It requires mounting assembly libgdiplus, libc6-dev in the Mirror Image

Construction of Dockerfile reads as follows:

# In the Microsoft-based `/ aspnetcore: latest` to build our image
FROM microsoft/aspnetcore:latest AS base
RUN apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev

# Copy all the files in the project publish folder to publish documents docker container folder  
COPY . /publish

# Set the working directory ` / publish` folder that container starts the default folder
WORKDIR /publish

# Use `main program to run the application .dll`
CMD [ " DOTNET " , " main .dll " ]

I spent most of the day time finally resolved.

By the way, if you use a version Core2.0 more directly to Dockerfile in <FROM microsoft / aspnetcore: latest AS base> Replace the contents of <FROM microsoft / aspnetcore: the version number of AS base>

 

Guess you like

Origin www.cnblogs.com/hank-hu/p/11791683.html