When using the PHP image inside of Docker, there are some extra steps needed when using certain PHP “Core” Extensions.
If you see errors related to 'PDO_MySQL' you may be missing the Docker extension.
You can find more about extensions here: PHP: Membership - Manual
Here is the page for PDO_MySQL: PHP: MySQL (PDO) - Manual
The PHP page on Dockerhub has examples of installing these extensions
If you scroll way down to PHP Core Extensions You can see an example of installing an extension.
RUN docker-php-ext-install -j$(nproc) iconv mcrypt
You will also need to enable it via
name: Install PHP extensions
sudo docker-php-ext-install pdo_mysql
sudo docker-php-ext-enable pdo_mysql
Article is closed for comments.