I'm setting up a new docker windows servercore image for my application. Data access uses ODBC Driver 17 for SQL Server. I need to install this on the image so in my Dockerfile
I included the following:
FROM mcr.microsoft.com/windows/servercore:ltsc2016
COPY msodbcsql_17.3.1.1_x64.msi c:\\msodbcsql_17.3.1.1_x64.msi
RUN msiexec.exe /i C:\\msodbcsql_17.3.1.1_x64.msi /norestart /qn IACCEPTMSODBCSQLLICENSETERMS=YES
...
When I run docker build...
I get the following error
The command 'cmd /S /C msiexec.exe /i C:\\msodbcsql_17.3.1.1_x64.msi /norestart /qn IACCEPTMSODBCSQLLICENSETERMS=YES' returned a non-zero code: 1603
Code 1603
indicates that a restart is required.
I'm not sure how an image can be restarted. How do I proceed ahead with this? Without the driver, I won't be able to get my application running.
1 Installing the Windows Connector/ODBC Driver Using the Zipped DLL Package. If you have downloaded the zipped DLL package: Unzip the installation files to the location you want it installed. Run the included batch file to perform an installation from the current directory and registers the ODBC driver.
The Microsoft ODBC Driver 17 for SQL Server provides native connectivity from Windows, Linux, & macOS to SQL Server and Azure SQL Databases. Note that this driver supports SQL Server 2019 only from version 17.3. More info about this driver can be found at the Microsoft product page.
So I ran the MSI manually in the container with logging enabled. It turns out that the failure was occurring due to missing VC++ redistributable.
So, I updated the Dockerfile
by adding a line to copy and install vc_redist.x64.exe
which fixed the issue for me.
Snippet from the Dockerfile
that solved the problem for me.
FROM mcr.microsoft.com/dotnet/framework/aspnet:4.7.2
COPY vc_redist.x64.exe c:/ \
msodbcsql_17.3.1.1_x64.msi c:/
RUN c:\\vc_redist.x64.exe /install /passive /norestart
RUN msiexec.exe /i C:\\msodbcsql_17.3.1.1_x64.msi /norestart /qn /quiet /passive IACCEPTMSODBCSQLLICENSETERMS=YES
...
Just posting this answer here in case someone else stumbles upon the same issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With