I am currently having trouble writing a Dockerfile for my php application. My Dockerfile works but lacks the pdo-odbc driver I need to connect to an MS SQL Server database.
According to https://github.com/docker-library/php/issues/103 you can try this:
FROM php
RUN apt-get update && apt-get install -y unixODBC-dev && rm -rf /var/lib/apt/lists/*
RUN set -x \
&& cd /usr/src/php/ext/odbc \
&& phpize \
&& sed -ri 's@^ *test +"\$PHP_.*" *= *"no" *&& *PHP_.*=yes *$@#&@g' configure \
&& ./configure --with-unixODBC=shared,/usr \
&& docker-php-ext-install odbc
This worked for me:
RUN apt-get install unixodbc unixodbc-dev -y \
&& docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr \
&& docker-php-ext-install pdo_odbc