8
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

DockerでMySQLのコンテナが立ち上がらない

Last updated at Posted at 2020-11-17

Docker使っててMySQLのコンテナが立ち上がらない現象にでくわしました。
原因はわかってないですが解決したので、一旦メモを残します

環境

  • Docker Desktop ver 2.5.0.1
  • Docker Compose ver 1.27.4
  • MySQL 8

先に結論

Use gRPC FUSE for file sharing をdisableにして Apply & Restart。

起きたこと

docker-compose up -d

を実行して

Creating network "xxx" with the default driver
Creating xxx_xxx_mysqldata_1 ... done
Creating xxx_mailhog_1   ... done
Creating xxx_xxx_mysql_1     ... done
Creating xxx                      ... done

の状態になったのですが、作業中にMySQL起因のエラーが発生。

確認してみる

docker ps

まず

docker ps

で何が立ち上がっているのか確認しましたが、MySQLのコンテナは立ち上がっていないようでした。
docker execでMySQLのコンテナに入れるのか試してもみましたが...

Error response from daemon: Container コンテナID is not running

だめでした。

docker-compose upしたときはdoneと出ていたので立ち上がっているものと思っていましたが...。

ログを見てみる

とりあえずこういう時はログを見てみないとなんとも言えないので、とりあえずログを確認します。

docker logs コンテナID

ログはこんな感じ

2020-11-17 07:30:22+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian10 started.
2020-11-17 07:30:23+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-11-17 07:30:23+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian10 started.
2020-11-17T07:30:24.278825Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2020-11-17T07:30:24.279399Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.19) starting as process 1
2020-11-17T07:30:24.298133Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2020-11-17T07:30:26.062069Z 1 [ERROR] [MY-011087] [Server] Different lower_case_table_names settings for server ('2') and data dictionary ('0').
2020-11-17T07:30:26.064235Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2020-11-17T07:30:26.064751Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-11-17T07:30:26.944800Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.19)  MySQL Community Server - GPL.

↓ここでなんか失敗してますね

2020-11-17T07:30:26.064235Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2020-11-17T07:30:26.064751Z 0 [ERROR] [MY-010119] [Server] Aborting

とりあえずbuildしなおしてみる

いろいろググるのがめんどくさくてbuildしなおしました。

docker-compose build --no-cache

buildが終わったので docker logs でログを見てみましょう。

2020-11-17 08:07:48+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian10 started.
2020-11-17 08:07:49+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-11-17 08:07:49+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian10 started.
2020-11-17T08:07:49.831146Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2020-11-17T08:07:49.831363Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.19) starting as process 1
2020-11-17T08:07:49.854161Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2020-11-17T08:07:51.391894Z 1 [ERROR] [MY-011087] [Server] Different lower_case_table_names settings for server ('2') and data dictionary ('0').
2020-11-17T08:07:51.392387Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2020-11-17T08:07:51.392606Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-11-17T08:07:52.248666Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.19)  MySQL Community Server - GPL.

なおってへんやん

解決した方法

これ
https://stackoverflow.com/questions/64146845/mysql-not-starting-in-a-docker-container-on-macos-after-docker-update

Docker DesktopのPreferences > Experimental Features で
Use gRPC FUSE for file sharing
をdisableにしてApply & Restart

その後docker-compose upしたら普通に立ち上がりました。

ちなみに別プロジェクトではほぼ同じセッティングでMySQL5.7を使用しており、そちらではUse gRPC FUSE for file sharingがenableになっていても全く問題ありませんでした。
MySQLのバージョン違いで起こる問題なんでしょうか

8
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?