I am always getting an error that PDO driver not found
. I tried restarting, installing PDO extensions directly. Note that this docker setup works on my Linux box last night. Only difference is I did it from scratch compared to on my Windows box I already has images.
After getting the error initially I tried to remove the images, the base PHP image failed to remove for some reason. I then ran:
docker exec -it php sh
docker-php-ext-install pdo pdo_mysql
Running that command explains that the extensions were already installed. But I still receive the error.
I also noticed this is present along with the modules:
/var/www/html # ls /usr/local/etc/php/conf.d/ docker-php-ext-pdo_mysql.ini /var/www/html # cat /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini extension=pdo_mysql.so
DockerFile PHP
FROM php:7.1-fpm-alpine RUN apk update && docker-php-ext-install pdo pdo_mysql && chown -R www-data:www-data /var/www/html && sed -ri 's/^www-data:x:82:82:/www-data:x:1000:50:/' /etc/passwd
PHP Modules on Docker Container
PS C:> docker exec -it php sh /var/www/html # php -m [PHP Modules] Core ctype curl date dom fileinfo filter ftp hash iconv json libxml mbstring mysqlnd openssl pcre PDO pdo_mysql pdo_sqlite Phar posix readline Reflection session SimpleXML SPL sqlite3 standard tokenizer xml xmlreader xmlwriter zlib [Zend Modules]
SysInfo
- Windows 10 Pro
- Docker version 17.06.0-ce, build 02c1d87
Advertisement
Answer
I did use to see the already installed message when I ran docker build but it still built the image fine for me.
https://github.com/fire015/docker/blob/master/php-fpm-71/Dockerfile
Try building it from fresh using docker build --no-cache=true