The blog about containerisation, virtual machines and useful shell snippets and findings

Docker wordpress php.ini upload_max_size

A) Add the following 2 lines to your wordpress Dockerfile:

RUN touch /usr/local/etc/php/conf.d/uploads.ini \
    && echo "upload_max_filesize = 10M;" >> /usr/local/etc/php/conf.d/uploads.ini

However, on the docker registry page they recommend adding a custom php.ini to /usr/local/lib.

B) Set the limits with your .htaccess file thats in your wordpress data directory.
In my case I have this directory under version control anyways, as would most.
The bottom 2 lines are what I added to my .htaccess on a brand new wordpress install via docker:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

php_value post_max_size 24M
php_value upload_max_filesize 8M