M1 Mac Docker Issues with apt-get update

  apple-m1, apt, debian, docker, dockerfile

I’m having an issue adding Microsoft package list to apt-get in my Dockerfile running on my M1 macbook pro. I was able to run this on my old windows laptop, but now on my mac, I get the Unable to locate package msodbcsql17 error. Just as a sanity check I also tried installing mssql-tools first, but that package was not found as well, so it seems like the entire process of adding these packages to apt-get is failing. Is there something I can do in order to get this to work for both m1 mac and machines using classic architecture?

FROM python:3.7

WORKDIR /app/repo

RUN mkdir /app/docker_volume

RUN apt-get update 
 && apt-get install unixodbc -y 
 && apt-get install unixodbc-dev -y 
 && apt-get install freetds-dev -y 
 && apt-get install freetds-bin -y 
 && apt-get install tdsodbc -y 
 && apt-get install --reinstall build-essential -y

RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl 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 msodbcsql17
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
RUN /bin/bash -c "source ~/.bashrc"```

Source: Dockerfile Questions

LEAVE A COMMENT