Unable to install SIMBA ODBC driver in debian container using docker file

Viewed 621

I have tried below command in my docker file but still its giving me the error :-

Dependency unixODBC with minimum version 2.3.1 is required. Unable to load shared library 'libodbc.so.2' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibodbc.so.2.so: cannot open shared object file: No such file or directory

FROM 52423406.dkr.ecr.us-east-1.amazonaws.com/base-dev:microsoft-dotnet-2.1-sdk AS buildEnv
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get install -y apt-utils
RUN apt-get install -y odbcinst1debian2 libodbc1 odbcinst unixodbc
RUN apt-get install -y libsasl2-modules-gssapi-mit
RUN apt-get install unzip
RUN wget https://databricks-bi-artifacts.s3.us-east-2.amazonaws.com/simbaspark-drivers/odbc/2.6.18/SimbaSparkODBC-2.6.18.1030-Debian-64bit.zip && unzip SimbaSparkODBC-2.6.18.1030-Debian-64bit.zip && dpkg -i simbaspark_2.6.18.1030-2_amd64.deb
WORKDIR ./sourceCode
COPY . .
RUN ls
RUN dotnet restore ./Services/Services.csproj --configfile ./nuget.config
# -o paramter value of publish command uses absolute path so that publishOutput folder is in root, using relative path would create it relative to the csproj folder.
RUN dotnet publish --no-restore -c Release -o /publishOutput ./Services.DeletionTool/Services.csproj


FROM 52423406.dkr.ecr.us-east-1.amazonaws.com/base-dev:microsoft-dotnet-2.1-runtime
WORKDIR ./app
COPY --from=buildEnv /publishOutput .
RUN ls
EXPOSE 80
EXPOSE 443
ENTRYPOINT ["dotnet", "Services.DeletionTool.dll"]

To fix this, I have tried installing libodbc1 , looks its getting installed with docker commands but when I am verifying the files in deployed container using kubernates console command, its not showing me the file at /usr/lib/x86_64-linux-gnu/libodbc.so.2 .. Looks like installed files not going to this path after running the docker commands. Please help if any suggestions.

1 Answers

Below two changes fixed this problem completely :

  1. placed linux commands after COPY --from=buildEnv /publishOutput so that it will copy the driver file in the target image.
  2. another error was due to databricks ODCB connector configuration required for /etc/odbc.ini and odbcinst.ini files, which got fixed by setting configs using below gawk command.

Follow below Simba Spark ODBC Driver connector documentation for more details about ini files configuration. https://docs.tibco.com/pub/spotfire_server/10.6.1/doc/pdf/TIBCO(R)%20ODBC%20Driver%20for%20Apache%20Spark%20SQL%20Installation%20Guide.pdf?id=12

FROM 7677668.dkr.ecr.us-east-1.amazonaws.com/base-dev:microsoft-dotnet-2.1-sdk AS buildEnv
WORKDIR ./sourceCode
COPY . .
RUN ls
RUN dotnet restore ./Services/Services.csproj --configfile ./nuget.config
RUN dotnet publish --no-restore -c Release -o /publishOutput ./Services.DeletionTool/Services.csproj


FROM 788898.dkr.ecr.us-east-1.amazonaws.com/base-dev:microsoft-dotnet-2.1-runtime
WORKDIR ./app
COPY --from=buildEnv /publishOutput .
RUN ls

RUN apt-get update && apt-get install -y odbcinst1debian2 libodbc1 odbcinst unixodbc && apt-get install -y libsasl2-modules-gssapi-mit && apt-get install unzip && apt-get install -y vim
RUN apt-get install wget && wget https://databricks-bi-artifacts.s3.us-east-2.amazonaws.com/simbaspark-drivers/odbc/2.6.18/SimbaSparkODBC-2.6.18.1030-Debian-64bit.zip && unzip SimbaSparkODBC-2.6.18.1030-Debian-64bit.zip && dpkg -i simbaspark_2.6.18.1030-2_amd64.deb 
RUN apt-get install -y gawk

RUN gawk -i inplace '{ print } ENDFILE { print "[ODBC Drivers]" }' /etc/odbcinst.ini
RUN gawk -i inplace '{ print } ENDFILE { print "Simba Apache Spark ODBC Connector 64-bit=Installed" }' /etc/odbcinst.ini
RUN gawk -i inplace '{ print } ENDFILE { print "[Simba Apache Spark ODBC Connector 64-bit]" }' /etc/odbcinst.ini
RUN gawk -i inplace '{ print } ENDFILE { print "Description=Simba Apache Spark ODBC Connector (64-bit)" }' /etc/odbcinst.ini
RUN gawk -i inplace '{ print } ENDFILE { print "Driver=/opt/simba/spark/lib/64/libsparkodbc_sb64.so" }' /etc/odbcinst.ini

RUN gawk -i inplace '{ print } ENDFILE { print "[ODBC Data Sources]" }'  /etc/odbc.ini
RUN gawk -i inplace '{ print } ENDFILE { print "Simba Spark=Simba Apache Spark ODBC Connector 64-bit" }'  /etc/odbc.ini
RUN gawk -i inplace '{ print } ENDFILE { print "[Simba Spark]" }'  /etc/odbc.ini
RUN gawk -i inplace '{ print } ENDFILE { print "Driver=/opt/simba/spark/lib/64/libsparkodbc_sb64.so" }'  /etc/odbc.ini
RUN gawk -i inplace '{ print } ENDFILE { print "SparkServerType=3" }'  /etc/odbc.ini
RUN gawk -i inplace '{ print } ENDFILE { print "ServiceDiscoveryMode=No Service Discovery" }'  /etc/odbc.ini
RUN gawk -i inplace '{ print } ENDFILE { print "Host=dssd-databricks.cloud.databricks.com" }'  /etc/odbc.ini
RUN gawk -i inplace '{ print } ENDFILE { print "Port=498" }'  /etc/odbc.ini
RUN gawk -i inplace '{ print } ENDFILE { print "UID=token" }'  /etc/odbc.ini
RUN gawk -i inplace '{ print } ENDFILE { print "PWD=sddsdsdsdsdds" }'  /etc/odbc.ini


EXPOSE 80
EXPOSE 443
ENTRYPOINT ["dotnet", "Services.DeletionTool.dll"]
Related