gpt4 book ai didi

sql-server - M1 MacBook 上的 Ubuntu (20.10) Docker 镜像上的 MSSQL 工具

转载 作者:行者123 更新时间:2023-12-04 18:25:28 31 4
gpt4 key购买 nike

在我的 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 .我已经尝试运行并通过 SSH 连接到容器中,但仍然遇到同样的错误。
% 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

最佳答案

我遇到了与上述问题类似的问题,发现问题是由于没有可用于 arm64 架构(M1 Mac)的 msodbcsql17 包。解决方案是将 docker 文件开头的基本镜像更改为

FROM --platform=linux/amd64 python:3.8.6
或者在你的情况下
FROM --platform=linux/amd64 ubuntu:20.10

关于sql-server - M1 MacBook 上的 Ubuntu (20.10) Docker 镜像上的 MSSQL 工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68357387/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com