php - how load mysql extensions dockerfile with Docker, Compose with Pfm and Nginx and Mysql -


i’m new docker & compose. i’ve created docker.yml file nginx, fpm & mysql. docker-compose.yml runs without errors...

i can execute php commands (ie see results of php commands in browser) i can’t execute mysqli commands. phpinfo.php shows '--enable-mysqlnd’ , appears installed. configuration file (php.ini) path /usr/local/etc/php doesn’t have php.ini… i’m not sure mysql commands work.

i think may need create dockerfile php , add mysql extensions after extracting them... not sure if that's needed....or how correctly - help!

compose file runs , brings 3 docker contains can connect to:

docker-compose.yml

version: '2'  services:     web:         image: nginx:latest         ports:             - "80:80"         volumes:             - ./code:/code             - ./site.conf:/etc/nginx/conf.d/default.conf         networks:             - code-network         links:            - php      php:         image: php:fpm         volumes:             - ./code:/code         networks:             - code-network         links:             - db     db:       image: mysql:5.7       ports:         - "3306:3306"       volumes:         - /var/lib/mysql         - ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d       environment:         - mysql_root_password=mypassword         - mysql_database=lbb       networks:         - code-network networks:     code-network:         driver: bridge 

dockerfile i've started work on creating @ moment doesn't extract code correctly .... not sure if need it!

dockerfile:

from php:7.0-fpm run docker-php-source extract  run apt-get update && \     && apt-get install -y \         libfreetype6-dev \         libjpeg62-turbo-dev \         libmcrypt-dev \         libpng12-dev \     && docker-php-ext-install -j$(nproc) iconv mcrypt \     && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \     && docker-php-ext-install -j$(nproc) gd \     && docker-php-ext-install mysqli pdo pdo_mysql 


Comments