What I'm trying to do
Install Microsoft's ODBC driver into a Docker image using the following Dockerfile
and the docker build
command.:
FROM public.ecr.aws/docker/library/python:3.9.10-slim-buster
RUN apt-get update
RUN apt-get install -y curl gnupg
RUN curl -sSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl -sSL https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql18
The majority of this Dockerfile is made up of commands from Microsoft's instructions on how to Install the Microsoft ODBC driver for SQL Server (Linux), specifically the Debian instructions.
What I expect to happen
Successful build of the Docker image.
What actually happens
docker build
successfully builds the image if Docker is run on an Intel based MacBook Pro.docker build
returns the following error when Docker is run on an Apple Silicon M1 based MacBook Pro :
=> ERROR [7/7] RUN ACCEPT_EULA=Y apt-get install -y msodbcsql18 0.7s
------
> [7/7] RUN ACCEPT_EULA=Y apt-get install -y msodbcsql18:
#10 0.192 Reading package lists...
#10 0.541 Building dependency tree...
#10 0.610 Reading state information...
#10 0.661 E: Unable to locate package msodbcsql18
------
executor failed running [/bin/sh -c ACCEPT_EULA=Y apt-get install -y msodbcsql18]: exit code: 100
I have observed this issue side by side with multiple MacBook Pro's of different processor types before coming to the conclusion that this is an "Apple silicon issue." The results of my observation using different MacBooks are as follows:
- MacBook Pro (14-inch, 2021) (M1) (FAILS TO BUILD)
- MacBook Pro (16-inch, 2021) (M1) (FAILS TO BUILD)
- MacBook Pro (13-inch, 2020) (Intel) (SUCCESSFUL BUILD)
- MacBook Pro (16-inch, 2019) (Intel) (SUCCESSFUL BUILD) (2 different MacBooks tested)
Other details
I have confirmed that public.ecr.aws/docker/library/python:3.9.10-slim-buster
is a Debian 10 based image by executing cat /etc/os-release
in a basic container made from this image, resulting in:
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
Conclusion
Given the blocker described above, how can I successfully install the Microsoft ODBC driver for SQL Server in a Docker image when Docker is installed on a MacBook Pro running on Apple's silicon?