When try to boot up my Docker container for MySQL, it kept exiting immediately.
Error log:
``
1 [ERROR] [MY-013171] [InnoDB] Cannot boot server version 80021 on data directory built by > version 80022. Downgrade is not supported
mysqld: Can't open file: 'mysql.ibd' (errno: 0 - )
1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
0 [ERROR] [MY-010119] [Server] Aborting
``
Problem:
Docker container is created for MySQL8.0.22 at before, and I update Dockerfile to running older 8.0.21. But the OLD image is still contained by Docker Desktop.
Remove image from Docker Desktop will not work. It will still Contained by Docker.
The solution:
- Delete all old images using Docker rmi command not Docker Desktop.
[x] Didn't work - Clear build cahche
docker builder prune
[x] Didn't work - Clear all volumes
docker system df
docker volume prune
[O] worked! - rebuild the container with the older version of MySQL and then restarting the container.
Reference(Thanks!):
Mysql | Docker → Can’t start Container because of Boot Server Version Error.
DockerのBuild Cacheの削除