I’ve recently been working with WordPress inside docker containers and discovered that file uploads are limited to 2MB, the apache default when using the official WordPress docker image. I don’t know of any sites that I’ve worked on that can actually work with only 2MB (possibly that is an indication of how abused WordPress is to turn it into something beyond a simple blogging platform). This brief guide provides you with one possible way of increasing the WordPress maximum file upload size in docker.
Firstly, create an
uploads.ini file, content is defined below
upload_max_filesize = 16M post_max_size = 16M
Now either mount the file using volumes in docker, or using docker compose. Below is an example except using docker-compose
wordpress: image: wordpress:latest ports: - "80:80" volumes: - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini - ./wp-content:/var/www/html/wp-content/