How Can You Fix the "No Matching Manifest for linux/arm64/v8 in the Manifest List Entries" Error for MySQL on Docker for Apple Silicon/M1?

To fix the “No Matching Manifest for linux/arm64/v8 in the Manifest List Entries” error for MySQL on Docker for Apple Silicon/M1, we can start by using a different MySQL image. This image should work well with ARM architecture. Instead of the usual MySQL image, we can use an ARM64-compatible image or create a custom MySQL Docker image just for our needs. This way, we can run MySQL smoothly on our Apple Silicon device without any problems.

In this article, we will look at different ways to fix the “No Matching Manifest for linux/arm64/v8” error in Docker, especially for MySQL on Apple Silicon. We will learn about what the error means. We will see how to use different MySQL images, how to build our own Docker image, how to turn on experimental features in Docker, how to use Rosetta 2 for better compatibility, and answer some common questions about this problem. Here’s what we will talk about:

  • Understanding the No Matching Manifest for linux/arm64/v8 Error in Docker
  • How to Use an Alternative MySQL Image for Apple Silicon
  • How to Build a Custom MySQL Docker Image for linux/arm64/v8
  • How to Enable Experimental Features in Docker for Apple Silicon
  • How to Use Rosetta 2 for Compatibility with MySQL on Docker
  • Frequently Asked Questions

Understanding the No Matching Manifest for linux/arm64/v8 Error in Docker

The “No Matching Manifest for linux/arm64/v8 in the Manifest List Entries” error happens when we try to pull a Docker image that does not work with ARM architecture. This is common for Apple Silicon devices like M1 or M2. The issue is that the image we want does not have an ARM version in Docker Hub or any other image repository.

Key Points:

  • Architecture Compatibility: Docker images are made for different CPU types like amd64 (x86_64) and arm64. If an image only supports amd64, then ARM-based machines can’t run it.
  • Manifest Lists: Docker uses manifest lists to find out which image to pull based on the host’s architecture. If Docker can’t find a suitable image, it shows this error.
  • Common Causes: If we try to run images made for linux/amd64 on a linux/arm64/v8 system without the right support, we get this error.

Example Command Causing the Error:

docker pull mysql:latest

If the mysql:latest image does not have an ARM version, we will see the manifest error.

Solution Approaches:

To fix this error and run MySQL on Docker for Apple Silicon, we will look at some methods. We will explain these methods in detail in the next sections.

How to Use an Alternative MySQL Image for Apple Silicon

To fix the “No Matching Manifest for linux/arm64/v8 in the Manifest List Entries” error when we use MySQL on Docker for Apple Silicon (M1), we can use a different MySQL image that works with ARM architecture. A good choice is the mysql:8.0 image. It has ARM versions.

To get an ARM-compatible MySQL image, we can tell Docker to use the right architecture with the platform flag. Here is how we do it:

docker pull --platform linux/arm64/v8 mysql:8.0

After we pull the image, we can run it with this command:

docker run --name mysql-arm -e MYSQL_ROOT_PASSWORD=root -d --platform linux/arm64/v8 mysql:8.0

In this command: - --name mysql-arm gives a name to the container. - -e MYSQL_ROOT_PASSWORD=root sets the root password for MySQL. - -d runs the container in the background.

If we want a different MySQL image that is better for ARM, we can use arm64v8/mysql. This version is made for ARM. We can pull and run it like this:

docker pull arm64v8/mysql

Then we run it:

docker run --name mysql-arm -e MYSQL_ROOT_PASSWORD=root -d arm64v8/mysql

Using an alternative MySQL image helps us work with Apple Silicon. It avoids the manifest error. For more details on Docker images and their types, we can check what are docker images and how do they work.

How to Build a Custom MySQL Docker Image for linux/arm64/v8

To build a custom MySQL Docker image for the linux/arm64/v8 architecture, we need to create a Dockerfile. This file will tell Docker what base image to use and how to set it up for ARM. Here are the steps we can follow.

  1. Create a Dockerfile: First, we create a file called Dockerfile in our project folder.
# Use an official MySQL base image that supports linux/arm64/v8
FROM mysql:8.0

# Set environment variables for MySQL root password and database
ENV MYSQL_ROOT_PASSWORD=rootpassword
ENV MYSQL_DATABASE=mydatabase

# Expose MySQL port
EXPOSE 3306

# Copy an initialization script (if needed)
COPY ./init.sql /docker-entrypoint-initdb.d/
  1. Create an Initialization Script (optional): If we have a script to set up our database, we can create a file named init.sql in the same folder.
CREATE TABLE IF NOT EXISTS users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(255) NOT NULL,
    password VARCHAR(255) NOT NULL
);
  1. Build the Docker Image: Next, we open our terminal. We go to the folder with our Dockerfile and run this command to build the image for ARM.
docker buildx build --platform linux/arm64/v8 -t custom-mysql-image .
  1. Run the Docker Container: After we build the image, we can run a container from it by using this command:
docker run --name mysql-arm -d -p 3306:3306 custom-mysql-image
  1. Verify the Container: Finally, we check if our MySQL container is running properly. We can do this with:
docker ps

This setup helps us run a MySQL instance in a Docker container made for the linux/arm64/v8 architecture. This is good for Apple Silicon/M1 devices. We should make sure Docker can build multi-platform images with buildx. For more information on Docker and multi-platform images, we can check this article.

How to Enable Experimental Features in Docker for Apple Silicon

To enable experimental features in Docker for Apple Silicon (M1/M2), we need to change the Docker configuration file. Let us follow these steps:

  1. Open Docker Desktop: First, we launch Docker Desktop on our Apple Silicon Mac.

  2. Access Docker Settings: Next, we click on the Docker icon in the menu bar. Then we select “Preferences”.

  3. Go to the Daemon Settings: In the Preferences window, we look for the “Docker Engine” tab.

  4. Edit the Configuration: Here, we add this JSON code to enable experimental features:

    {
      "experimental": true,
      "features": {
        "buildkit": true 
      }
    }
  5. Apply Changes: Now, we click “Apply & Restart” to save our changes and restart Docker.

  6. Verify Experimental Features: After Docker restarts, we can check if experimental features are on. We run this command in our terminal:

    docker version --format '{{.Server.Experimental}}'

    It should show true. This means that experimental features are now on.

By enabling experimental features, we can use new tools and improvements in Docker. These are made for Apple Silicon architecture.

How to Use Rosetta 2 for Compatibility with MySQL on Docker

To run MySQL on Docker for Apple Silicon or M1 devices, we can use Rosetta 2. It helps x86_64 applications work on ARM architecture. Here is how we can set it up:

  1. Install Rosetta 2 (if we don’t have it yet): Open our terminal and run:

    softwareupdate --install-rosetta
  2. Run Docker Desktop under Rosetta: We need to run Docker with Rosetta. Go to our Applications folder, find Docker, right-click it, and choose “Get Info”. We should check the “Open using Rosetta” box.

  3. Pull the MySQL image: We can use the terminal to pull an x86 MySQL image:

    docker pull mysql:latest
  4. Run the MySQL container: Let’s start the MySQL container with the right environment variables:

    docker run --name mysql-container -e MYSQL_ROOT_PASSWORD=root -d mysql:latest
  5. Access MySQL: To get into the MySQL server, we can use this command:

    docker exec -it mysql-container mysql -uroot -proot

With Rosetta 2, we can run MySQL on Docker for Apple Silicon devices. This way, it works well with x86_64 images. For more info about using Docker on different architectures, check this article.

Frequently Asked Questions

What is the “No Matching Manifest for linux/arm64/v8” error in Docker?

The “No Matching Manifest for linux/arm64/v8” error happens when Docker does not find a fitting image for the ARM64 system. This is common on Apple Silicon (M1) devices. It usually means that the MySQL image you want does not support ARM architecture. To fix this, we can use a different MySQL image that works with ARM64 or create our own image.

How can I run MySQL on Docker for Apple Silicon?

To run MySQL on Docker for Apple Silicon, we can use an ARM-compatible MySQL image. Another option is to make a custom MySQL Docker image that supports ARM. Using images from places like mysql/mysql-server can be useful. But we have to check if they are compatible with ARM64. We can also look for multi-architecture images that support many systems.

What are the best MySQL Docker images for ARM architecture?

Some of the best MySQL Docker images that work with ARM architecture include arm64v8/mysql and some tags of mysql/mysql-server. We should check the image’s support for ARM64 by using the docker manifest inspect command. This way, we know we are pulling an image that fits our system.

How do I enable experimental features in Docker on Apple Silicon?

To enable experimental features in Docker on Apple Silicon, we need to change the Docker configuration file. We can do this by editing the ~/.docker/config.json file. We add "experimental": "enabled" to the file. After we save the file, we should restart Docker for the changes to work. This allows us to use advanced features that may help with architecture issues.

Can I use Rosetta 2 to run MySQL on Docker?

Yes, we can use Rosetta 2 to run x86_64 MySQL images on Apple Silicon. Rosetta 2 helps apps made for Intel Macs to run on ARM Macs. When we pull a MySQL Docker image, we need to say what architecture to use. This can help us run x86_64 MySQL containers smoothly on our M1 device.