Expected behavior
I have created a python script to connect with azure database which is running fine locally and in azure python functions.
Actual behavior
But when deployed in azure container instance. It was throwing error that Odbc 17 Driver not found.
Additional Information
Steps to reproduce the behavior
- Steps in docker file
FROM python:3.6.8
RUN mkdir \opt\message_to_event_hub
WORKDIR \opt\message_to_event_hub
ADD odbcinst.ini /etc/odbcinst.ini
RUN apt-get update
RUN apt-get install -y tdsodbc unixodbc-dev unixodbc unixodbc-bin
RUN apt install unixodbc-bin -y
RUN apt-get clean -y
RUN pip install pyodbc
RUN apt-get install -y curl wget gnupg
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN apt-get install unixodbc-dev
*RUN TEMP_DEB="$(mktemp)" *
*&& ACCEPT_EULA=Y && wget -O “$TEMP_DEB” ‘https://packages.microsoft.com/debian/9/prod/pool/main/m/msodbcsql17/msodbcsql17_17.2.0.1-1_amd64.deb’ *
*&& yes | dpkg --skip-same-version -i “$TEMP_DEB” *
&& rm -f “$TEMP_DEB”
*ADD . . *
CMD [“python3”,“pyodbcConnect.py”]
- python steps to connect with database
import pyodbc
pyodbc.connect(dbconnection)