DEV Community

Cover image for Cannot Start MySQL 8.0.17 Container on M1 Mac
Kenta Takeuchi
Kenta Takeuchi

Posted on • Originally published at bmf-tech.com

Cannot Start MySQL 8.0.17 Container on M1 Mac

This article was originally published on bmf-tech.com.

I recently upgraded to an M1 Mac and tried to run a MySQL container for my local development environment, but it didn't work.

Here's the error:

runtime: failed to create new OS thread (have 2 already; errno=22)
Enter fullscreen mode Exit fullscreen mode

Since it was a Go error, I guessed it might be an architecture-related issue.

I checked Docker Hub for a version newer than 8.0.17 and found that the latest patch version 8.0.26 had been released.

https://hub.docker.com/layers/mysql/library/mysql/8.0.26/images/sha256-75e71ac9b332935f396d85965213a64f1bd6fc7c42e9900b106f7af462c599b0?context=explore

It seems it was released just two days ago.

It looks like MySQL 8.0.26 includes support for M1, so it might work with this version.
cf. https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-26.html

macOS: It is now possible to build MySQL for macOS 11 on ARM (that is, for Apple M1 systems). (Bug #32386050, Bug #102259)
Enter fullscreen mode Exit fullscreen mode

Specify --platform and set the image to 8.0.26.

FROM --platform=linux/amd64 mysql:8.0.26

ADD ./conf.d/my.cnf /etc/mysql/conf.d/my.cnf

CMD ["mysqld"]
Enter fullscreen mode Exit fullscreen mode

This worked for now.

Top comments (0)