In order to resolve an issue, I am now trying install the mysql pdo via
docker-php-ext-install
as pointed out in the README of the php imag
RUN docker-php-ext-install mbstring pdo pdo_mysql \
That code can do install any extension you want in this case mysql pdp driver but the Dockerfile should have base of FROM php:7.1.8-apache
FROM php:7.1.8-apache