I am a beginner with docker and docker-compose and i need your help.
I'm making PHP-NGINX-PostgresSQL symfony developement environment using docker-compose.
Here it is :
web:
image: nginx:1.13.5
ports:
- "80:80"
volumes:
- ./html:/html
- ./site.conf:/etc/nginx/conf.d/default.conf
links:
- php
php:
image: php:7-fpm
volumes:
- ./html:/html
links:
- postgres
postgres:
image: postgres:9.6.5
ports:
- "5432:5432"
environment:
POSTGRES_PASSWORD: postgres
Now, i would like to install php7.2-intl into my php container. So i would like to execute something like :
$ sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install php7.2-intl
Could you help me? I'm really stuck and also I dont have a Dockerfile file, just a docker-compose.yml file.
To get a PHP docker container with the intl extension, you need to extend the official PHP image.
To do so, declare the use of your own Dockerfile
for your PHP image in docker-compose.yml
:
services:
php:
# Remove this line
# image: php:7-fpm
# Add this one instead
build: './docker/php'
# ...
Then, add the following Dockerfile
file to the docker/php
folder:
FROM php:7.1-fpm
RUN apt-get update && apt-get install -y \
libicu-dev \
&& docker-php-ext-install \
intl \
&& docker-php-ext-enable \
intl
You can now run docker-compose build
to get your PHP container built with the Intl extension.
A few notes:
php:7-fpm
.docker-php-ext-install
and docker-php-ext-enable
command utilities provided by the PHP official image (see "How to install more PHP extensions" section in the PHP image documentation).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With