22 Oct 2022




Developing WordPress with Docker on Apple Silicon

WordPress Development by Digital Apps

Let’s setup our development environment using docker. Firstly download docker for apple silicon.

Download, install and launch.

To make sure docker has been installed, open your terminal and run a following command:

$ docker -v

You should see something similar to this: Docker version 20.10.20, build 9fdeb9c

Navigate to a project folder of you choice and create a file docker-compose.yml

Paste below and save:

You can execute the docker scrip in two ways:

  1. Download VSCode extension docker, right click on the yml file, and select compose up
  2. Alternatively just open your terminal and run: $ docker-compose up --build

Please note containers are temporary any data that you create will be lost if containers are restarted. For persistent data we need to create volumes for our containers. There are several ways to create volumes for containers. Volumes are are created outside of your container which are mounted inside of your container. You could also have your containers stored in the cloud on services such as amazon S3.

Docker is running slow on m1 apple silicon if your mysql image is anything other then arm64v8/mysql . It’s actually a big let down when I first used docker. Every page load would take about 20secons or so. Theres no way you can develop on the system this slow.

Use arm64v8/mysql image and page load speed becomes instant. Adding platform: linux/x86_64 had no effect for me.