繁体   English   中英

msodbcsql17 安装失败

[英]Failing installation of msodbcsql17

我正在尝试更新使用 python:3.9 作为基础的 docker 映像(使用 Debian GNU\/Linux 10(buster)),但现在它失败了,之前的步骤没有问题。 新图像 sha 是@sha256:8f642902ba368481c9aca0a100f08daf93793c6fa14d3002253ea3cd210383a7<\/code> ,我使用的命令可以在这里找到https:\/\/docs.microsoft.com\/en-us\/sql\/connect\/odbc\/linux-mac\/installing-the-microsoft- odbc-driver-for-sql-server?view=sql-server-ver15#debian17<\/a> 。

这是输出错误:

#20 0.380 Reading package lists...
#20 0.838 Building dependency tree...
#20 0.942 Reading state information...
#20 0.998 Some packages could not be installed. This may mean that you have
#20 0.998 requested an impossible situation or if you are using the unstable
#20 0.998 distribution that some required packages have not yet been created
#20 0.998 or been moved out of Incoming.
#20 0.998 The following information may help to resolve the situation:
#20 0.998
#20 0.998 The following packages have unmet dependencies:
#20 1.049  libodbc1 : PreDepends: multiarch-support but it is not installable
#20 1.049  odbcinst1debian2 : PreDepends: multiarch-support but it is not installable
#20 1.062 E: Unable to correct problems, you have held broken packages.
------
executor failed running [/bin/sh -c ACCEPT_EULA=Y apt-get install -y msodbcsql17]: exit code: 100

TL;DR:使用 Debian 11 的 Bullseye 构建现在是 Python 3 基础镜像的默认版本。 您可以切换到“-buster”版本或将次要版本号修复为前一个版本。

我昨天遇到了同样的问题,并通过恢复到以前版本的 python 基础映像来修复它。

在您的 Dockerfile 中,如果您使用的是:

FROM python:3.9 ,然后将其更改为FROM python:3.9.5

FROM python:3.8 ,然后将其更改为FROM python:3.8.10

FROM python:3.7 ,然后将其更改为FROM python:3.7.10

FROM python:3.6 ,然后将其更改为FROM python:3.6.13

这不会解决根本原因,并且会阻止您在基础 Docker 映像的次要版本升级中获得修复。

或者,您可以坚持使用 buster 构建,例如, python:3.9-buster

Bullseye 版本在 4 天前发布,并成为所有 python 3 图像的默认版本。 这包括从 Debian 9升级到Debian 11

但是,对于生产系统,我建议将次要版本号修复为适合您的版本号。

正如@AlwaysLearning 在评论中提到的,确实 debian 版本已更新。 我使用 python:3.9-buster 作为基础解决了这个问题

根本原因是 MS DB 驱动程序与新发布的 Python 3.9 映像使用的 Debian 发行版不兼容。 您可以通过查看注册 MS 存储库的 dockerfile 中的配置来验证它。 它将特定于较旧的 Debian。

如果 MS 驱动程序支持新的 Debian,那么您可以在其 db 驱动程序的 MS 官方文档中找到更新的配置。

如果 MS Driver 不支持新的 Debian,那么您需要使用仍然基于支持的 Debian 版本的 Python 映像的变体,并保留存储库配置。

对我来说,唯一的解决方法是将 Dockerfile 中的基本映像从FROM python:3.6-buster更改为FROM --platform=linux/amd64 python:3.6-buster 在 M1 芯片(苹果)上构建映像的人可能需要 --platform 标志。

如果您不想更改 Dockerfile 中的平台规范,您可以在构建映像时将其添加为docker build --platform=linux/amd64并且应该也可以。

暂无
暂无

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

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