MySQL Docker Image for Mac ARM M1

Emmanuel Gautier / February 26, 2022

2 min read

For a few years now, Apple released new ARM-based SoC for Mac: Apple M1 and Apple M2 CPU. There are 64-bit ARMv8 processors specially designed for MacOS and iPadOS. Linux Kernel also brings supports this SoC since version 5.13.

Various software and Docker images are not compatible with the microarchitecture ARMv8 and the MySQL official Docker image is one of them. Let's see how using MySQL with Apple M1, Apple M2, and more globally ARMv8.

Use ARM64v8 Docker Image

In order to use a MySQL Docker image with ARMv8, you need to use the arm64v8/mysql docker image instead of the official mysql/mysql-server. More tags are available on the official Docker Hub ARM64v8 repository.

This solution should also work for other SoC using AMRv8 micro-architecture. Those kind of ARM-compatible docker images are also available for other technologies like PHP, Python, Mongo, ... etc.

Here is an additional example of docker-compose file using the above image:

docker-compose.yml
version: '3'

services:
  db:
    image: arm64v8/mysql:oracle
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    expose:
      - 3306
    environment:
      MYSQL_RANDOM_ROOT_PASSWORD: "true"

Build your own image

When a docker image is not available for an architecture, another option is basically to build the image on this architecture. This way, you can build your own image from the official Docker Github repository.

Consulting

If you're seeking solutions to a problem or need expert advice, I'm here to help! Don't hesitate to book a call with me for a consulting session. Let's discuss your situation and find the best solution together.

Share this post
Follow the RSS feed