Script to find all drivers
I created a script to find all 'pyodbc' drivers:
import pyodbc
print([x for x in pyodbc.drivers()])
The problem
In my host computer (Windows with drivers installed), when I'm run i get all x64 drivers:
> ['SQL Server', 'ODBC Driver 17 for SQL Server', 'Microsoft Access Driver (*.mdb, *.accdb)', 'Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)', 'Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx)', 'Microsoft Access Text Driver (*.txt, *.csv)']
But, when I use Docker
FROM python:3.8-alpine
# Add dependencies
RUN apk upgrade
RUN apk add --no-cache curl gcc g++ unixodbc-dev
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h
WORKDIR /app
# Install Python dependencies
COPY requirements.txt ./
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
# Run script
COPY find_drivers.py find_drivers.py
CMD [ "python3", "find_drivers.py" ]
Drivers are not found:
> []
References
What the best way to install "Microsoft Access Driver (*.mdb, *.accdb)" in this Docker image?