I`m having a hard time installing the required packages for a Python/pyodbc app to run.
I’m trying to run it using the below code on a Dockerfile:
FROM python:3.9-slim-buster
RUN apt-get update
RUN apt-get clean
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 && ACCEPT_EULA=Y apt-get install -y msodbcsql17
COPY main.py requirements.txt /app/
WORKDIR /app
RUN pip install -r requirements.txt
CMD ["python", "main.py"]
# Start the Flask app
CMD gunicorn app:app -b 0.0.0.0:80
But it’s throwing the following error:
error: failed to solve: process "/bin/sh -c curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -" did not complete successfully: exit code: 255
I tried several variations of this code, but none seem to work. What’s the correct way of installing MSSQL packages so I can run an app that uses pyodbc?
It appears that cURL may not have been installed correctly in your image. To address this issue, you can try installing a few OS-level dependencies before running the cURL commands.
One possible solution is to follow the example set by this image, which includes the necessary dependencies for cURL to function properly.