mysqlmacosdockercontainersapple-silicon

docker run mysql image command not working [MacBook Pro M1]


I was following the official docker labs hands-on tutorial for multi-container apps tutorials. While running the below command on MacBook Pro M1 terminal

docker run -d `
    --network todo-app --network-alias mysql `
    -v todo-mysql-data:/var/lib/mysql `
    -e MYSQL_ROOT_PASSWORD=secret `
    -e MYSQL_DATABASE=todos `
    mysql:5.7

I am getting the below error.

docker: no matching manifest for linux/arm64/v8 in the manifest list entries.


Solution

  • If anyone else runs into this issue while following the guide on a Mac M1 machine specifically, the quickest work-around is probably to add the flag:

    --platform linux/amd64
    

    like

    docker run -d \
        --platform linux/amd64 \
        --network todo-app --network-alias mysql \
        -v todo-mysql-data:/var/lib/mysql \
        -e MYSQL_ROOT_PASSWORD=secret \
        -e MYSQL_DATABASE=todos \
        mysql:5.7
    

    Credits to https://github.com/docker/getting-started/issues/144