Docker Compose MySQL Keeps Restarting
Run into a strange bug where the MySQL container would keep restarting. The error I would see from the logs would be
[ERROR] --initialize specified but the data directory has files in it. Aborting.
You can view container logs by typing
docker logs -f <db_container_name>
I tried to rebuild the container by running
docker-compose build
and
docker-compose up -d
but to no avail. Finally stumbled on a solution via a GitHub issue here. The solution was to run
docker system prune --volumes
which cleared out the said directory then after building the container worked.
© Paul Ngumii.RSS