Goals
  1. Run WordPress via Docker / Docker-Compose

  2. Increase the Upload Filesize Limit

Create Docker Compose Configuration

Create a docker-compose.yml:

version: '3.1'

services:

  wordpress:
    image: wordpress
    restart: always
    ports:
      - 8080:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: exampledb
    volumes:
      - wordpress:/var/www/html

  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_DATABASE: exampledb
      MYSQL_USER: exampleuser
      MYSQL_PASSWORD: examplepass
      MYSQL_RANDOM_ROOT_PASSWORD: '1'
    volumes:
      - db:/var/lib/mysql

volumes:
  wordpress:
  db:

Run Docker Compose / Start Containers

docker-compose up
WARNING: Found orphan containers (wordpress-docker_phpmyadmin_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Starting wordpress-docker_db_1        ... done
Starting wordpress-docker_wordpress_1 ... done
Attaching to wordpress-docker_db_1, wordpress-docker_wordpress_1
[..]
db_1         | 2021-04-03T18:58:17.247963Z 0 [Note] mysqld: ready for connections.
db_1         | Version: '5.7.33'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)

Increase File Upload Limits

Find Container name/id:

docker ps
CONTAINER ID   IMAGE       COMMAND                  CREATED          STATUS          PORTS                  NAMES
58e193187158   wordpress   "docker-entrypoint.s…"   28 minutes ago   Up 28 minutes   0.0.0.0:8080->80/tcp   wordpress-docker_wordpress_1
ac9263f40b83   mysql:5.7   "docker-entrypoint.s…"   28 minutes ago   Up 28 minutes   3306/tcp, 33060/tcp    wordpress-docker_db_1

Attach to container:

docker exec -i -t 58e193187158 /bin/bash

Change to html directory an edit the .htaccess file:

cd /var/www/html
vi .htaccess
php_value upload_max_filesize 256M
php_value upload_max_filesize 256M