LoginSignup
8
4

More than 5 years have passed since last update.

Dockerのoverlay2でMySQLが起動しない問題を解決する

Last updated at Posted at 2018-11-21

公式のMySQLコンテナは、Storage Driverがoverlay、overlay2だとMySQLが起動しないことがあります。

Docker for Mac(Windows)は、デフォルトのStorage Driverがoverlay2なので、この問題を回避するために、Storage Driverをaufsに変更していました。

aufs_win.png

※ちなみに、CoreOSではdevicemapperに変更していました。
https://qiita.com/yKanazawa/items/1827325c92fd4651a912

しかし、先日リリースされた、Docker for Windows 2.0.0.0-Mac78(Win78)では、aufsへの切り替えができなくなっていました。

なので、この問題に本格的に向き合うことになったのですが、以下のGitHub issueが大変参考になりました。

MySQL does not start with overlay2 and overlay but starts with aufs
https://github.com/docker/for-linux/issues/72

Fatal error: Can't open and lock privilege tables: Table storage engine for 'user' doesn't have this option
https://serverfault.com/questions/870568/fatal-error-cant-open-and-lock-privilege-tables-table-storage-engine-for-use

MySQLの起動前に以下のコマンドを実行することで、MySQLが起動できるようになります。

find /var/lib/mysql -type f -exec touch {} \;
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