dockerでMySQLだけ立ち上がらなかった
具体的にはWSL2 + Docker Desktop for Windows (+ Docker Compose) で諸々のコンテナをdocker-compose up -d
で立ち上げようとしたらMySQLのコンテナ(5.7の最新版)だけ立ち上がらなかった
# docker-compose ps
Name Command State Ports
------------------------------------------------------------------------------------------------
test-_back_1 /wait-for-it.sh mysql-db ... Up 0.0.0.0:8080->8080/tcp
test-_front_1 /bin/sh -c envsubst '$$TES ... Up 0.0.0.0:3000->80/tcp
test-_mysql-db_1 docker-entrypoint.sh mysqld Exit 1
logを見てみる
docker-compose logs -f
でlogを確認
log
mysql-db_1 | 2020-10-17 02:54:50+09:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.31-1debian10 started.
mysql-db_1 | 2020-10-17 02:54:50+09:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
mysql-db_1 | 2020-10-17 02:54:50+09:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.31-1debian10 started.
mysql-db_1 | 2020-10-17 02:54:50+09:00 [Note] [Entrypoint]: Initializing database files
mysql-db_1 | mysqld: [Warning] World-writable config file '/etc/mysql/conf.d/my.cnf' is ignored.
mysql-db_1 | 2020-10-16T17:54:50.236065Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
mysql-db_1 | 2020-10-16T17:54:50.243510Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
mysql-db_1 | 2020-10-16T17:54:50.984126Z 0 [Warning] InnoDB: New log files created, LSN=****
mysql-db_1 | 2020-10-16T17:54:51.113491Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
mysql-db_1 | 2020-10-16T17:54:51.128211Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: ********
mysql-db_1 | 2020-10-16T17:54:51.133628Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
mysql-db_1 | mysqld: Can't change permissions of the file 'ca-key.pem' (Errcode: 1 - Operation not permitted)
mysql-db_1 | 2020-10-16T17:54:51.184562Z 0 [ERROR] Could not set file permission for ca-key.pem
mysql-db_1 | 2020-10-16T17:54:51.184583Z 0 [ERROR] Aborting
mysql-db_1 |
と出ていて最終的には
mysql-db_1 | 2020-10-16T17:54:51.184562Z 0 [ERROR] Could not set file permission for ca-key.pem
mysql-db_1 | 2020-10-16T17:54:51.184583Z 0 [ERROR] Aborting
でこけてる
解決方法
ググると以下のIssueが見つかった
見てると**mysql:5.7
からmysql:5.7.16
**へ変更すると動くというレスがあったのでバージョンを変更してみたら動くようになりました。
(自分の場合はdocker-compose.yml
にMySQLのバージョンを書いてたのでそこを変更)
おわり
- マウントする際の権限云々が関係してる?みたいですが自分的にはローカルでとりあえず動けばいいのでこれで良しとしておきます