This post assumes that Docker and Docker Compose are installed on your local machine. If not follow the guide for your operating system:
Set up your docker-compose.yml
Mostly following Quickstart: Compose and WordPress.
Create a project directory and any folders you wish to simlink
mkdir my-wordpress wp-content
This is where your project will live, it will be launched from this folder and the relevant folders (themes/plugins) will be sim linked here so you can work on them.
if you want to be able to upload files bigger than 2 MB to your WordPress install then create an
uploads.iniand add the following content:
file_uploads = On memory_limit = 64M upload_max_filesize = 64M post_max_size = 64M max_execution_time = 600
docker-compose.ymlfile in that directory and add the following to it:
version: '3.3' services: db: image: mysql:5.7 volumes: - db_data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: somewordpress MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress wordpress: depends_on: - db image: wordpress:latest ports: - "8000:80" restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress volumes: - /route/to/project/folder/wp-content:/var/www/html/wp-content - /route/to/project/folder/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini volumes: db_data:
docker-compose up -dand navigate to:
localhost:8000to complete the famous 5 minute install.