【问题标题】:How to install ODBC Driver 17 in a docker image based on windows server core?如何在基于 windows server core 的 docker 镜像中安装 ODBC Driver 17?
【发布时间】:2019-07-16 06:34:58
【问题描述】:

我正在为我的应用程序设置一个新的 docker windows servercore 映像。数据访问使用ODBC Driver 17 for SQL Server。我需要在图像上安装它,所以在我的Dockerfile 中包含以下内容:

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
...

当我运行docker build... 时,出现以下错误

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

代码1603表示需要重启。

我不确定如何重新启动映像。我该如何进行呢?如果没有驱动程序,我将无法运行我的应用程序。

【问题讨论】:

    标签: docker dockerfile docker-for-windows


    【解决方案1】:

    所以我在启用了日志记录的容器中手动运行了 MSI。事实证明,失败是由于缺少 VC++ 可再发行组件而发生的。

    所以,我更新了Dockerfile,添加了一行来复制和安装vc_redist.x64.exe,这为我解决了这个问题。

    来自Dockerfile 的片段为我解决了这个问题。

    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 
    
    ...
    

    只是在这里发布这个答案,以防其他人偶然发现同样的问题。

    【讨论】:

    • 你能分享结果Dockerfile吗?
    • @PieterMeiresone,我用 Dockerfile 中的相关部分更新了答案。希望这会有所帮助。
    • 谢谢,我不熟悉在 powershell 中安装可执行文件,所以所有位都有帮助。
    • 你用什么开关来获取日志文件?
    • @Choco 遵循此页面上的指导advancedinstaller.com/user-guide/qa-log.html
    猜你喜欢
    • 2020-05-23
    • 1970-01-01
    • 1970-01-01
    • 2022-07-12
    • 1970-01-01
    • 2021-08-15
    • 2020-09-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多