What's up guys? me again.
I'm working on a project that i started with this code:
#docker-compose.yml
version: '3.8'
services:
nginx:
build:
context: .
dockerfile: nginx.dockerfile
ports:
- 80:80
volumes:
- ./src:/var/www/html
depends_on:
- mysql
- php
mysql:
image: mysql:5.7.41
ports:
- 3306:3306
environment:
MYSQL_DATABASE: laravel
MYSQL_USER: laravel
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: secret
volumes:
- ./mysql:/var/lib/mysql
php:
build:
context: .
dockerfile: php.dockerfile
volumes:
- ./src:/var/www/html
depends_on:
- mysql
#php.dockerfile
FROM php:8-fpm-alpine
ENV PHPGROUP=laravel
ENV PHPUSER=laravel
RUN adduser -g ${PHPGROUP} -s /bin/sh -D ${PHPUSER}
RUN sed -i "s/user = www-data/user = ${PHPUSER}/g" /usr/local/etc/php-fpm.d/www.conf
RUN sed -i "s/group = www-data/group = ${PHPGROUP}/g" /usr/local/etc/php-fpm.d/www.conf
RUN mkdir -p /var/www/html/public
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer
CMD ["php-fpm", "-y", "/usr/local/etc/php-fpm.conf", "-R"]
#nginx.dockerfile
FROM nginx:stable-alpine
ENV NGINXUSER=laravel
ENV NGINXGROUP=laravel
RUN mkdir -p /var/www/html/public
ADD nginx/default.conf /etc/nginx/conf.d/default.conf
RUN sed -i "s/user www-data/user ${NGINXUSER}/g" /etc/nginx/nginx.conf
RUN adduser -g ${NGINXGROUP} -s /bin/sh -D ${NGINXUSER}
It has been working well. Thing is, i installed GD library adding the following code to the php.dockerfile file:
RUN apk add --no-cache freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev && \
docker-php-ext-configure gd && \
NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
docker-php-ext-install -j${NPROC} gd && \
apk del --no-cache freetype-dev libpng-dev libjpeg-turbo-dev
It ran ok, i checked with phpinfo() that the library was installed, which it did, but now, all of the sudden, i'm having issues with the DB, i get this error:
could not find driver (Connection: mysql, SQL: select * from `games` order by `title` asc)
I've tried deleting both the nginx and php container, to re-build them using docker-compose up --build (after having removed the GD related lines from the php.dockerfile file), but the problem remains. I've also stashed all my changes in the repo and re-executed composer install, but the problem remains.
I can access to the DB with the same credentials i had from before, via MariaDB
Does anyone might know what could be happening?