Skip to content
A stack of VHS cassettes

Increase WordPress maximum upload limit in Docker

Wednesday, 31 March 2021

At 432 words, this article should take about 2 minutes to read.

This article is more than a year old and the information in it may be out of date.

I've recently moved over to using Docker to manage my WordPress builds. It has many advantages and, the more comfortable I get, relatively few disadvantages. Not sponsored or anything, it's just boss!

One thing I find happens every single time is trying to upload an image into the Media Library and getting the "filename exceeds the maximum upload size for this site" error.

filename exceeds the maximum upload size for this site

Inevitably, I find myself sticking docker wordpress increase upload limit into Bing (yes, Bing). There are a few answers knocking around - some of which I can get to work, some of which I can't.

This is the solution that I find works for me. I'm posting it here to save myself an hour of Googling next time! ๐Ÿ˜…

Step 1: uploads.ini

Firstly, create an uploads.ini file in your project. I like to keep mine in a specific config folder with my .htaccess file.

Step 2: Add your options

In the uploads.ini file, add the following:

upload_max_filesize = 16M
post_max_size = 24M

Feel free to change the values to suit your needs.

Step 3: Include your file

The file now needs mounting using volumes.

If you're using docker-compose, it will look a little something like this:

version: '3.1'

    image: wordpress:5.7.0-php7.3-apache
    restart: always
      - 80:80
      - ./config/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
      - ./www/themes:/var/www/html/wp-content/themes:delegated
      - ./www/plugins:/var/www/html/wp-content/plugins:delegated


And that's it!

Start or restart Docker and you'll no longer get nasty errors when you try to upload that massive photo.

Just be aware that upload limits exist for good reason - nobody wants to have to download a tonne of 10Mb 1920ร—1080 images that are only going to be used as 300px thumbnailsโ€ฆ

Cover image courtesy of Daniel von Appen.



In almost all cases, the comments section is a vile cesspool of Reply Guys, racists, and bots.

I don't want to have to deal with that kind of hell so I don't have a comments section.

If you want to continue the conversation, you can always hit me up on Twitter (which is, in its own way, a vile cesspool of Reply Guys, racists, and bots).

Thomas Rigby

Thomas Rigby

When I'm not building things for the internet, I take photos of stuff.
Loading Invisible Visible Navigation Close Arrow Info Online Online