1

我有一个 dockerfile 可以在 Azure 上上传一些 python 代码。它已经工作了几个月,但今天它突然停止工作。

Dockerfile中的相关命令有:

FROM python:3.9.5
:
:
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN exit
RUN apt-get update && ACCEPT_EULA=Y apt-get install msodbcsql17

今天出现的错误信息是:

Err:1 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 msodbcsql17 amd64 17.7.2.1-1
  404  Not Found [IP: 104.214.230.139 443]
E: Failed to fetch https://packages.microsoft.com/ubuntu/20.04/prod/pool/main/m/msodbcsql17/msodbcsql17_17.7.2.1-1_amd64.deb  404  Not Found [IP: 104.214.230.139 443]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get update && ACCEPT_EULA=Y apt-get install msodbcsql17' returned a non-zero code: 100
2021/06/16 20:50:56 Container failed during run: build. No retries remaining.
failed to run step ID: build: exit status 100

我相信这可能与被移动的 .deb 文件有关 - 或者微软的某些计算机已关闭?

一个好的解决方法可能是直接下载相关的 msodbcsql17 包,但我无法在正常的 repos 中找到这个包?

4

3 回答 3

2

对于某些 linux 发行版(包括 ubuntu 和 debian),microsoft repos 似乎存在一些持续的问题。不清楚什么时候会解决这个问题。

https://github.com/dotnet/core/issues/6381

https://github.com/MicrosoftDocs/sql-docs/issues/6494

于 2021-06-17T09:40:00.133 回答
1

答案可能与这篇文章有关: https ://github.com/dotnet/core/issues/6381

似乎某些 Ubuntu 存储库已损坏。希望它会尽快修复...

于 2021-06-17T09:58:17.533 回答
0

我会密切关注解决方案,但我有同样的问题,使用:

FROM python:3
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql17
# optional: for bcp and sqlcmd
RUN ACCEPT_EULA=Y apt-get install -y  mssql-tools
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
# optional: for unixODBC development headers
RUN apt-get install -y unixodbc-dev
于 2021-06-17T10:51:06.240 回答