简体   繁体   English

无法使用 docker 文件在 debian 容器中安装 SIMBA ODBC 驱动程序

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

I have tried below command in my docker file but still its giving me the error :-我在我的 docker 文件中尝试了以下命令,但仍然给我错误:-

Dependency unixODBC with minimum version 2.3.1 is required.需要最低版本为 2.3.1 的依赖 unixODBC。 Unable to load shared library 'libodbc.so.2' or one of its dependencies.无法加载共享库“libodbc.so.2”或其依赖项之一。 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为了帮助诊断加载问题,请考虑设置 LD_DEBUG 环境变量: 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.为了解决这个问题,我尝试安装libodbc1 ,看起来它是使用docker命令安装的,但是当我使用kubernates控制台命令验证已部署容器中的文件时,它没有向我显示/usr/lib/x86_64-linux-gnu/ 中的文件libodbc.so.2 .. 运行 docker 命令后,安装的文件似乎不会进入此路径。 Please help if any suggestions.如果有任何建议,请帮助。

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.在 COPY --from=buildEnv /publishOutput 之后放置 linux 命令,以便它将驱动程序文件复制到目标映像中。
  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.另一个错误是由于/etc/odbc.iniodbcinst.ini文件所需的 databricks ODCB 连接器配置,通过使用以下 gawk 命令设置配置已修复。

Follow below Simba Spark ODBC Driver connector documentation for more details about ini files configuration.请按照以下 Simba Spark ODBC 驱动程序连接器文档了解有关 ini 文件配置的更多详细信息。 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 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"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM