Skip to content

Commit a38890f

Browse files
committed
Build/Test Tools: Fix bug pulling local environment containers on Apple silicone.
The MySQL Docker containers for versions 5.7 and below do not support recent Apple silicone chips. Previously this was fixed by including `amd64/` as a prefix to the image name in the `docker-compose.yml` file (see [54096]). However, this stopped working after recent updates to Docker Desktop. This changeset removes the `amd64/` prefix for the image used as the database container and raises the default version of MySQL in the local development environment to the current LTS version (8.0). Because this version is still maintained, there are `arm64` containers available to use. This also documents a new workaround for contributors looking to run the local Docker environment using MySQL 5.7 or earlier, which entails creating a small `docker-compose.override.yml`. Merges [57568] to the 6.4 branch. Props bernhard-reiter, johnbillion, afragen, huzaifaalmesbah. Fixes #59930. git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57862 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 2e60def commit a38890f

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ LOCAL_DB_TYPE=mysql
4646
##
4747
# The database version to use.
4848
#
49-
# Defaults to 5.7 with the assumption that LOCAL_DB_TYPE is set to `mysql` above.
49+
# Defaults to 8.0 with the assumption that LOCAL_DB_TYPE is set to `mysql` above.
5050
#
5151
# When using `mysql`, see https://hub.docker.com/r/amd64/mysql for valid versions.
5252
# When using `mariadb`, see https://hub.docker.com/r/amd64/mariadb for valid versions.
5353
##
54-
LOCAL_DB_VERSION=5.7
54+
LOCAL_DB_VERSION=8.0
5555

5656
# The debug settings to add to `wp-config.php`.
5757
LOCAL_WP_DEBUG=true

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,29 @@ Starting the environment again is a single command:
111111
npm run env:start
112112
```
113113

114+
#### Resetting the development environment
115+
116+
The development environment can be reset. This will destroy the database and attempt to remove the pulled Docker images.
117+
118+
```
119+
npm run env:reset
120+
```
121+
122+
### Apple Silicone machines and old MySQL versions
123+
124+
The MySQL Docker images do not support Apple Silicone processors (M1, M2, etc.) for MySQL versions 5.7 and earlier.
125+
126+
When using MySQL <= 5.7 on an Apple Silicone machine, you must create a `docker-compose.override.yml` file with the following contents:
127+
128+
```
129+
services:
130+
131+
mysql:
132+
platform: linux/amd64
133+
```
134+
135+
Additionally, the "Use Rosetta for x86/AMD64 emulation on Apple Silicon" setting in Docker needs to be disabled for this workaround.
136+
114137
## Credentials
115138

116139
These are the default environment credentials:

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ services:
6565
# The MySQL container.
6666
##
6767
mysql:
68-
image: amd64/${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
68+
image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
6969

7070
networks:
7171
- wpdevnet

0 commit comments

Comments
 (0)