問題描述
我只能在我的 macbook air m1 上使用 docker preview 玩,我不能通過 docker-compose 文件運行 8.0.22 版本的 mysql 鏡像.
I can only play in my macbook air m1 with docker preview and i can't run an image of mysql with version 8.0.22 through a docker-compose file.
docker-compose 集
我運行的命令是:docker-compose up -d mysql
我該如何解決這個問題?
How can I solve this problem?
推薦答案
我們剛剛遇到了這個問題,我從 這個答案.你可以在 docker-compose
文件中指定你的平臺,所以在你的情況下它看起來像:
We've just ran into this issue, and I took the solution from this answer. You can specify your platform in the docker-compose
file, so in your case it would look like:
services:
mysql:
image: mysql:8.0.22
platform: linux/x86_64
container_name: mysqldb
restart: always
ports:
- 3306:3306
volumes:
- mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=test
- MYSQL_DATABASE=DATA
在我們公司,我們使用 M1 和 Intel Mac,此解決方案使 mysql 映像可用于兩者.
In our company, we use M1 and Intel Macs and this solution makes mysql image available for both.
這篇關于在 m1 處理器中運行的 Docker 鏡像的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!