I have a small Docker network based on this package for Docker Compose and Laravel. I'd like to set the upload_max_filesize and post_max_size variables in php.ini to allow for larger file uploads.
Is this possible? Or is there an alternative approach? I expected to find lots of similar questions on the web, but it's not that many and typically they concern some existing image, while I create the PHP image from a Dockerfile.
This is from docker-compose.yml:
php:
build:
context: .
dockerfile: php.dockerfile
container_name: php
volumes:
- ./src:/var/www/html
ports:
- "9000:9000"
networks:
- laravel
This is php.dockerfile
FROM php:7.4-fpm-alpine
WORKDIR /var/www/html
RUN apk add --no-cache zip libzip-dev
RUN docker-php-ext-configure zip
RUN docker-php-ext-install zip
RUN docker-php-ext-install pdo pdo_mysql
Here is a sample of overriding some php.ini values instead of editing the php.ini directly. 

You can create your own php.ini locally and COPY it in your dockerfile for instance.
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