When I was testing Docker’s initial tutorial when you download for the first time I got the error:
The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64) and nospecific platform was requested
.
It sucks because I got a new MacBook Pro M1 and I did not know about these issues with arm64 chips and images. Trying to play with the tutorial while having great coffee from Latin America I got stuck when trying to run the MySQL image in my compose file.
Searching around I found two options to resolve this. See below:
Option 1: Add the flag –platform linux/arm64
This will tell your MacOS M1 what platform to use. Brief example:
docker run -d \
--platform linux/amd64 \
--network todo-app --network-alias mysql \
-v todo-mysql-data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=secret \
-e MYSQL_DATABASE=todos \
mysql:5.7
Option 2: Use MariaDB instead of MySQL
As of this post MariaDB offers official support for ARM64 architecture. Use this docker command instead as an example:
docker run -d \
-v todo-mysql-data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=secret \
-e MYSQL_DATABASE=todos \
mariadb:10.5
Feel free to contact me if you have any questions. Also, if you like to code with coffee make sure to checkout my shop with inspirational coffee mugs and T-Shirts.
- Rsync Coffee Mug with Color Inside 11oz$20.00
- apt install Coffee Mug$19.95
- yum install Coffee Mug$19.95