If you are trying to import settings from existing WordPress site once you start your local WordPress docker container, you will realise the default max upload size is 2mb.
To increase the upload file size, we can specify custom php.ini file (in our case upload.ini) and setup the Docker compose file to copy it within container.
Create file upload.ini
in the same folder as docker-compose.yml
$ touch upload.ini
Code language: Bash (bash)
Add following in upload.ini to change the upload_max_filesize.
upload.ini
file_uploads = On
memory_limit = 64M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 600
Update the docker-compose.yml
file and mount the local upload.ini
file.
wordpress:
depends_on:
- db
image: wordpress
restart: always
volumes:
- ./:/var/www/html/wp-content
- ./upload.ini:/usr/local/etc/php/conf.d/uploads.ini
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
ports:
- 80:80
- 443:443
networks:
- wp
Code language: YAML (yaml)
Restart the docker container by running docker-compose up -d
Check the max image size under Media > Add New
Source Code
The docker-compose.yml is available in Github for further update.
Github – source code