Not all images are available for ARM64 architecture. You can add --platform linux/amd64 to run an Intel image under emulation. In particular, the mysql image is not available for ARM64. You can work around this issue by using a mariadb image.
composeの例。
mysql_gdpr: platform: linux/x86_64 image: mysql/mysql-server:8.0.23 ports: - "3306:3306" environment: MYSQL_DATABASE: "user_security" MYSQL_RANDOM_ROOT_PASSWORD: 1 MYSQL_USER: "security" MYSQL_PASSWORD: "pleasechangeit"
対策としては、
- mariadbを使う
- platformでlinux/x86_64を指定してみる
でも
However, attempts to run Intel-based containers on Apple Silicon machines under emulation can crash as qemu sometimes fails to run the container. In addition, filesystem change notification APIs (inotify) do not work under qemu emulation. Even when the containers do run correctly under emulation, they will be slower and use more memory than the native equivalent.
こういうことが書いてあるっていうことはやっぱりARMでIntelなコンテナを動かすのは無理があるっぽいので油断は禁物。