DEV Community

kaede
kaede

Posted on

Docker-compse で MySQL を単体で動かす

brew cask では M1 の Docker App は入らない

https://kunolog.com/docker-desktop-m1/

この記事の通りに brew install --cask docker をやると

Image description

M1 に対応しない Docker が入ってしまう

Docker.com から Apple Chip 用の Docker を入れる

https://docs.docker.com/desktop/mac/install/

公式サイトに

Image description

Appleの m1 チップ用のインストールボタンがある。

Image description

インストールできた!
見やすい!

docker-compose --version
docker-compose version 1.29.2, build 5becea4c
Enter fullscreen mode Exit fullscreen mode

docker-compose も入っていた

動作させる

docker-compose.yml を作成する

version: "3.7"
services:
  db:
    image: mysql:latest
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
Enter fullscreen mode Exit fullscreen mode

mysql だけ動かす

docker-compose up
Creating network "docker-mysql_default" with the default driver
Pulling db (mysql:latest)...
latest: Pulling from library/mysql
ERROR: no matching manifest for linux/arm64/v8 in the manifest list entries
Enter fullscreen mode Exit fullscreen mode

普通のだとむり

https://stackoverflow.com/a/65592942

platform: linux/x86_64
Enter fullscreen mode Exit fullscreen mode

プラットフォームを指定すれば arm 用のが使える

Attaching to docker-mysql_db_1
db_1  | 2021-10-17 17:05:28+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.26-1debian10 started.
db_1  | 2021-10-17 17:05:29+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1  | 2021-10-17 17:05:29+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.26-1debian10 started.
db_1  | 2021-10-17 17:05:29+00:00 [Note] [Entrypoint]: Initializing database files
db_1  | 2021-10-17T17:05:29.932099Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.26) initializing of server in progress as process 100
db_1  | 2021-10-17T17:05:30.017444Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
db_1  | 2021-10-17T17:05:30.038544Z 1 [ERROR] [MY-012585] [InnoDB] Linux Native AIO interface is not supported on this platform. Please check your OS documentation and install appropriate b
inary of InnoDB.
db_1  | 2021-10-17T17:05:30.039290Z 1 [Warning] [MY-012654] [InnoDB] Linux Native AIO disabled.
db_1  | 2021-10-17T17:05:30.827103Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
db_1  | 2021-10-17T17:05:34.403943Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
db_1  | 2021-10-17T17:05:34.406790Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
db_1  | 2021-10-17T17:05:34.598348Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
db_1  | 2021-10-17 17:05:40+00:00 [Note] [Entrypoint]: Database files initialized
db_1  | 2021-10-17 17:05:40+00:00 [Note] [Entrypoint]: Starting temporary server
db_1  | 2021-10-17T17:05:40.488893Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.26) starting as process 155
Enter fullscreen mode Exit fullscreen mode

動いた

Image description

アプリでも確認できる!

Top comments (0)