在我的M1 MacbookPro上,我创建了一个Dockerfile文件:
FROM ubuntu:20.10
RUN apt-get update
RUN apt-get install -y curl gnupg2
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/20.10/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN exit
RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql17
RUN ACCEPT_EULA=Y apt-get install -y mssql-tools
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
RUN source ~/.bashrc它使用Ubuntu 20.10镜像,并尝试安装Microsoft's ODBC Driver。我已经按照Microsoft's documentation执行了命令。
当我运行构建时,我得到了一个错误的Unable to locate package msodbcsql17。我尝试在容器中运行和SSHing,但仍然得到相同的错误。
% docker build .
[+] Building 5.3s (11/14)
=> [internal] load build definition from Dockerfile 0.4s
=> => transferring dockerfile: 37B 0.0s
=> [internal] load .dockerignore 0.5s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:20.10 2.8s
=> [ 1/11] FROM docker.io/library/ubuntu:20.10@sha256:6b603b0f3b8fc71b1a97bd38e081e8df04793f1447362c12385b48106aaded3f 0.0s
=> CACHED [ 2/11] RUN apt-get update 0.0s
=> CACHED [ 3/11] RUN apt-get install -y curl gnupg2 0.0s
=> CACHED [ 4/11] RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 0.0s
=> CACHED [ 5/11] RUN curl https://packages.microsoft.com/config/ubuntu/20.10/prod.list > /etc/apt/sources.list.d/mssql-release.list 0.0s
=> CACHED [ 6/11] RUN exit 0.0s
=> CACHED [ 7/11] RUN apt-get update 0.0s
=> ERROR [ 8/11] RUN ACCEPT_EULA=Y apt-get install -y msodbcsql17 1.8s
------
> [ 8/11] RUN ACCEPT_EULA=Y apt-get install -y msodbcsql17:
#11 0.893 Reading package lists...
#11 1.278 Building dependency tree...
#11 1.347 Reading state information...
#11 1.394 E: Unable to locate package msodbcsql17
------
executor failed running [/bin/sh -c ACCEPT_EULA=Y apt-get install -y msodbcsql17]: exit code: 100发布于 2021-10-14 14:17:45
我遇到了与上面的问题类似的问题,我发现这个问题是由于没有适用于arm64架构(M1 Mac)的msodbcsql17包。解决方案是将docker文件开头的基础图像更改为
FROM --platform=linux/amd64 python:3.8.6或者在你的情况下
FROM --platform=linux/amd64 ubuntu:20.10发布于 2021-07-13 14:30:57
从您的errorUnable中找到package msodbcsql17,找到以下链接。
https://stackoverflow.com/questions/68357387
复制相似问题