Update php.ini when using a Docker image
A step-by-step guide on how to update your php.ini file inside a Docker container using a compose.yaml volume mount. Solve common issues like maximum file upload size.
This article is over a year old but was reviewed on July 30, 2026 — the content is still accurate.
This article is part of the Create your joomla website using Docker series:

This article shows how to override php.ini settings (e.g. the max upload file size) in a Dockerized PHP site: create a local php.ini file, mount it over the container's config file via a volumes entry in compose.yaml, then docker compose down && docker compose up --detach to apply the change.
This article aims to answer the following situation: I'm using a Docker image to run my website and I should modify the php.ini file; how do I do this?
A real-world example is: you've followed my article Create your Joomla website using Docker and everything is working fine. The website is running, and you wish to upload a big file to your site using the Joomla administration web interface. But, then, you get an error The selected file cannot be transferred because it is larger than the maximum upload size allowed.

One of the easiest ways to do is to create a .ini file on your disk and share the file with your container.
Most probably, you'll have a compose.yaml file, please edit the file.
For the illustration, below you'll find a copy of the simplest compose.yaml file you can retrieve in my Create your Joomla website using Docker blog post. You can have yours of course. This is just for example.
services: joomla: image: joomla restart: always ports: - 8080:80 environment: - JOOMLA_DB_HOST=joomladb - JOOMLA_DB_PASSWORD=example
joomladb: image: mysql:8.0.13 restart: always environment: - MYSQL_ROOT_PASSWORD=exampleThis is a Docker Compose configuration that sets up two services: a Joomla web application and a MySQL database that it depends on. The Joomla service exposes a web port and connects to the database using environment variables, while the database service runs MySQL and stores its root password as an environment variable.
Step one - Update your yaml file
The solution is to add the volumes line if not yet present in your file and, the most important one, the line for overriding the php.ini file like below:
services: joomla: image: joomla restart: always ports: - 8080:80 environment: - JOOMLA_DB_HOST=joomladb - JOOMLA_DB_PASSWORD=example # highlight-next-line volumes: # highlight-next-line - ./php.ini:/usr/local/etc/php/php.ini
joomladb: image: mysql:8.0.13 restart: always environment: - MYSQL_ROOT_PASSWORD=exampleThis is a Docker Compose configuration that sets up two services: a Joomla web application and a MySQL database it depends on. The Joomla service is exposed on port 8080, configured to connect to the database, and uses a custom PHP configuration file. Both services are set to restart automatically if they crash.
Step two - Create your own php.ini file
The second thing to do is to create a file called php.ini in the same folder as your compose.yaml where you'll define your variables; f.i.
file_uploads = Onmemory_limit = 500Mupload_max_filesize = 500Mpost_max_size = 500Mmax_execution_time = 600This is a PHP configuration file that sets limits for file uploads and script execution. It allows large files (500 megabytes) to be uploaded, gives scripts more memory to work with, and lets them run longer before timing out.
So, now, your folder contains at least two files:
Step three - Restart your container
This done, just run docker compose down ; docker compose up --detach in your terminal to stop your current container(s) and restart it/them.
Now, when restarting, Docker will take into account your latest changes and update accordingly the php.ini file that is present in Docker.






