M1 MacBook 上的 Ubuntu (20.10) Docker 映像上的 MSSQL 工具

时间:2021-07-13 06:19:42

标签: sql-server docker ubuntu apple-m1

在我的 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

1 个答案:

答案 0 :(得分:0)

来自你的错误[无法找到包 msodbcsql17 ] 找到以下链接。

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