I am using docker to build my dev enviroment, a very simple env where all i have is nginx and php-fpm.
So following docker docks I have created a docker-compose.yml:
web:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./code:/code
- ./site.conf:/etc/nginx/conf.d/site.conf
links:
- php
php: image: php:7-fpm volumes: - ./code:/code
So what happens here i call nginx image and pgp-fpm image and link them.
I have also created a site.conf file:
server {
index index.php;
server_name php-docker.local;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /code;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
So here is all the server stuff.
with this set up i have sucesfully runned phpinfo(). When i However aded my app code i get an error complaning about pdo pdo_mysql extensions. So i did more research and found out i need a Dockerfile.
I created a docker file and and inside it added this commands:
FROM php:7
RUN docker-php-ext-install pdo pdo_mysql
Of course this does not work, I mean where does this install the extensions and how does my php-fpm supoose to see these extensions...?
RUN docker-php-ext-install pdo_mysql. I assume there is a similar method for FPM, see that readme and the corresponding github repo.docker-compose buildbefore runningdocker-compose up -d?