How do I make the libdb2.so file visible to the DB2 package? I have verified that the package works in Ubuntu, but I cannot make it work inside Docker.
Dockerfile
FROM microsoft/aspnetcore:1.0
#assume the built app is in /app from the build so that the entrypoint command runs in the correct path
WORKDIR /app
#need to specify db2 driver lib
ENV LD_LIBRARY_PATH="/app/db2Lib"
#move all the source code in local directory ./app into the container directory /app
COPY ./app .
RUN mkdir -p db2Lib
ADD db2Lib db2Lib/
ADD ./runImage.sh .
RUN chmod -R a+wrx runImage.sh
EXPOSE 8080
ENTRYPOINT ["./runImage.sh"]
runImage.sh
#!/bin/bash
ls $LD_LIBRARY_PATH
echo $LD_LIBRARY_PATH
dotnet app.dll
Upon running the image, I get the following prints in the console
#from ls $LD_LIBRARY_PATH
icc
libDB2xml4c.so
libDB2xml4c.so.58
libDB2xml4c.so.58.0
libdb2.so
libdb2.so.1
libdb2clixml4c.so
libdb2clixml4c.so.1
libdb2o.so
libdb2o.so.1
#from echo $LD_LIBRARY_PATH
/app/db2Lib
but when my application runs, I get the following error
Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'libdb2.so': The specified module could not be found.
As you can see, the LD_LIBRARY_PATH environment variable properly points to the correct directory as the documentation instructs at https://www.ibm.com/developerworks/community/blogs/96960515-2ea1-4391-8170-b0515d08e4da/entry/Instructions_for_downloading_and_using_DB2_NET_Core_provider_package?lang=en.
To double check that the environment variable is being set, I do
Console.WriteLine(Configuration["LD_LIBRARY_PATH"]);
which indeed prints
/app/db2Lib