Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RHEL 8 Container MSSQL ODBC Driver e2fsprogs

I'm trying to build a custom docker container using the RHEL 8 UBI. As part of this I want to install the MSSQL 17 ODBC driver. I've followed the steps outlined in Microsofts Documentation here: https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15#redhat17

And added the Microsoft repo to my yum.repos.d directory however when I try to build the container I get the following error: nothing provides e2fsprogs needed by msodbcsql17-17.6.1.1-1.x86_64

When I dug a bit further into this it looks as though it looks as though for RHEL-7 Microsoft suggest installing e2fsprogs manually you can see that here: 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

This unfortunately isn't possible in RHEL-8 as e2fsprogs-static has been removed: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/considerations_in_adopting_rhel_8/index#removed-packages_changes-to-packages

The full output from the build is:

$  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

This error is pretty reproducible here is the test dockerfile i'm using to debug


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

Has anyone managed to get this ODBC driver installed on an RHEL 8 UBI based container?

like image 995
daark Avatar asked Aug 05 '20 09:08

daark


People also ask

How install ODBC Driver for SQL Server Linux?

Before you install the driver, execute the following command: ./install.sh verify . The output of ./install.sh verify reports if your computer has the required software to support the ODBC driver on Linux.


2 Answers

I found a work around that I hope will help the next person to hit this. Rather than running yum install -y msodbcsql17 I instead used yum to download the RPM yum download -y msodbcsql17 then used rpm -Uvh --nodeps msodbcsql17*rpm to install it.

You can use this docker file:

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 download -y msodbcsql17
RUN rpm -Uvh --nodeps msodbcsql17*rpm
like image 155
daark Avatar answered Nov 15 '22 08:11

daark


@daark thank you for posting your solution. Your solution got me over the problem I was facing. I ended modifying your solution to the following (in case it helps anyone else):

FROM registry.access.redhat.com/ubi8/python-38

USER root
RUN yum update --assumeyes && \
  yum install --assumeyes \
    unixODBC-devel \
  && yum clean all

RUN curl https://packages.microsoft.com/config/rhel/8/prod.repo > /etc/yum.repos.d/mssql-release.repo
RUN yum download -y msodbcsql17
RUN ACCEPT_EULA=y rpm -Uvh --nodeps msodbcsql17*rpm

I tried to add this to the @daark's solution as a comment, but it was too difficult to display the code properly.

Good luck to anyone else facing this issue 🍀

like image 33
Zhao Li Avatar answered Nov 15 '22 08:11

Zhao Li