I'm dockerizing lemp stack with following docker-compose config:
mariadb:
container_name: lemp-mariadb
image: mariadb
#user: $UID
environment:
- MYSQL_ROOT_PASSWORD=root.maria
- MYSQL_DATABASE=wordpress
- MYSQL_USER=wordpress
- MYSQL_PASSWORD=wordpress
volumes:
- ./db:/var/lib/mysql
phpfpm:
container_name: lemp-fpm
image: php:7-fpm
volumes:
- ./code:/code
links:
- mariadb
command: docker-php-ext-install mysqli
nginx:
container_name: lemp-nginx
image: nginx:latest
ports:
- "8080:80"
volumes:
- ./code:/code
- ./site.conf:/etc/nginx/conf.d/default.conf
links:
- phpfpm
command: nginx -g 'daemon off;'
Problem lies with with line in config:
command: docker-php-ext-install mysqli
If I comment this line during docker-compose up routine, it runs fine leaving 3 of the machines running, All I have to do is run this command on lemp-fpm machine via docker exec like this:
docker exec lemp_phpfpm_1 docker-php-ext-install mysqli
which gives no error and I can connect to database with mysqli extension. The lemp-fpm instance quits with 0 erro code when same command runs via docker-compose. The question is why? and what's the work-around?