How to run MySQL 5.7 on Docker on ARM.

Here is how you can run it anyways

Logos of MySQL™ and Apple™ M1 | created by author

If you try to run the official mysql:5.7, 5.6 or 5.5 images in a new Mac, you’ll get this message:

unable to find image locally…

Oracle does not officially support the old MySQL 5.x versions on ARM. You can see that in their supported platforms overview:

So what can we do?

The newer MySQL 8 is supported on ARM, and the official docker image has support for it.

But, if your project wasn’t planning to move to the newer MySQL version anyways, you probably shouldn’t run MySQL 8 locally as a workaround.

The fork of MySQL is mostly compatible with its brother and can be used as a replacement. And it does officially support ARM64.

But here, you have to be aware that your local environment might not exactly be the same as the live environment.

The question I can’t answer is which version to choose for the best MySQL 5.7 support. I tried the latest 10 version (10.8), and it worked great for my use case.

The source code of MySQL is open, and there isn’t anything stopping you from just compiling it for ARM64. Debian and Ubuntu have mysql-server-5.7 images for arm for years, even though they are somewhat more dated than the x86 variants.

There are also already premade images out there. I had great luck with the biarms/mysql:5.7 image. It has the same options and environment variables as the official docker image, so it can be a drop-in replacement.

You can even tag it locally, so it gets used instead of the official Docker Image.

# docker pull biarms/mysql:5.7
# docker tag biarms/mysql:5.7 mysql:5.7

Then, every project referencing the mysql:5.7 will automatically and unknowingly use the biarms image.

This should be a last resort because of performance, but if you need the same version somewhere else and performance does not matter at that moment, docker is perfectly able to emulate x86.

docker run --rm \
--platform linux/amd64 \
-p 3306:3306 \

Note that this emulation is using QEMU inside the existing Linux VM. So it isn’t Rosetta 2 doing its translation thing. But it is surprisingly usable.

This is cheating, but it is still an option, especially if you have multiple images that don’t have an x86 version. I have an entire guide on how to do that:

As you can see, you have many options to toy with. Especially the unofficial way is probably the way to go.

But the emulation way is interesting too. It means you can run everything in a pinch, even if it is suboptimal.

News Credit

%d bloggers like this: