MySQL Docker Image for Mac ARM M1

Emmanuel Gautier / February 26, 2022

1 min read

For a few years now, Apple released a new SoC for Mac using ARM M1 CPU. It is a 64-bit ARMv8 processor specially designed for their MacOS and iPadOS. Linux Kernel also supports it now since version 5.13.

The issue is that number of software are not compatible with the microarchitecture ARMv8. It is the case of MySQL official Docker image for example.

To be able to use MySQL official Docker image on Mac with M1 CPU, you need to use the arm64v8/mysql image instead or mysql/mysql-server maintained by the Oracle team. More tags are available on the official Docker Hub repository.

This solution should also work for other SoC using AMRv8 micro-architecture and it is also available for other Docker Images like PHP, Python, Mongo, ... etc.

Another option is to build your own image from the official Github repository.

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"
Share this post
Follow the RSS feed

Subscribe to the newsletter

Get emails from me about web development and a lot of topics related to tech.