我正在尝试使用 RHEL 8 UBI 构建自定义 docker 容器。作为其中的一部分,我想安装 MSSQL 17 ODBC 驱动程序。我已按照此处的 Microsoft 文档中概述的步骤进行操作: https ://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql- server?view=sql-server-ver15#redhat17
并将 Microsoft 存储库添加到我的yum.repos.d
目录中,但是当我尝试构建容器时,出现以下错误:nothing provides e2fsprogs needed by msodbcsql17-17.6.1.1-1.x86_64
当我对此进行深入研究时,它看起来好像对于 RHEL-7 微软建议手动安装 e2fsprogs 您可以在此处看到:https ://docs.microsoft.com/en-us/sql/connect/odbc /linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15#offline-installation
不幸的是,这在 RHEL-8 中是不可能的,因为 e2fsprogs-static 已被删除:https ://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/considerations_in_adopting_rhel_8/index#removed-packages_changes-到包
构建的完整输出是:
$ docker build -f ./test.dockerfile -t daark:1 .
Sending build context to Docker daemon 25.77MB
Step 1/7 : FROM registry.redhat.io/ubi8/ubi
---> a1f8c9699786
Step 2/7 : RUN curl https://packages.microsoft.com/config/rhel/8/prod.repo > /etc/yum.repos.d/mssql-release.repo
---> Using cache
---> 90b3e1514239
Step 3/7 : RUN yum search odbc
---> Using cache
---> b26f78d0da28
Step 4/7 : RUN yum search msodbcsql17
---> Using cache
---> c6f7751b97dc
Step 5/7 : ENV ACCEPT_EULA=Y
---> Using cache
---> 2b0003944673
Step 6/7 : RUN yum install -y unixODBC unixODBC-devel
---> Using cache
---> 1d0b8c594905
Step 7/7 : RUN yum install -y msodbcsql17
---> Running in 67c30e75fb42
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:08:11 ago on Wed Aug 5 09:36:32 2020.
Error:
Problem: cannot install the best candidate for the job
- nothing provides e2fsprogs needed by msodbcsql17-17.6.1.1-1.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
The command '/bin/sh -c yum install -y msodbcsql17' returned a non-zero code: 1
这个错误很容易重现这里是我用来调试的测试 dockerfile
FROM registry.redhat.io/ubi8/ubi
RUN curl https://packages.microsoft.com/config/rhel/8/prod.repo > /etc/yum.repos.d/mssql-release.repo
RUN yum search odbc
RUN yum search msodbcsql17
ENV ACCEPT_EULA=Y
RUN yum install -y unixODBC unixODBC-devel
RUN yum install -y msodbcsql17
有没有人设法将这个 ODBC 驱动程序安装在基于 RHEL 8 UBI 的容器上?