MariaDB does not start in container

Hello,

I have a container in Docker Desktop on Mac OS X that is a Debian Image with an instance of a Mariadb Server.
The database’s data directory is outside the container, configured as a Bind Mount.

Days ago It started just fine. Now it doesn’t. When starting Mariadb complains that it cannot find system tables like mysql.db and others like that one.

I am at version 4.92.0. I went into the container’s details and in the Bind Mounts section I can see the mount and if I click on the link I am taken to the mounted path in the host computer.

Could the mount not being made so that the container does not have it ? I am ruling out the possibility of the mariadb files being corrupted, but one step at a time.

I upgraded docker desktop to version 4.95.3 but got the same result.

Thanks,
Regards

Do you see the path (or a parent folder) in settings → File Sharing → Virtual file shares?

Did you try to exec into the container to see if the files exist - or if the container stops right away try the same with an ad-hoc container?

This command will start an ad-hoc alpine container and drops you in the sh shell. The /problematic/host/path is a placeholder that needs to be replaced with the host path where your data directory is on the host:

me@MacBook-Pro-of-me test % docker run -ti --rm -v /problematic/host/path:/test -w /test alpine 

Then look around.

I would also check if the bind mount target was set correctly. If not, and the data was stored on the original volume and deleted or not mounted back, even if the intended source is on the host, it is possible that it was never actually used. The volume target should be /var/lib/mysql

On the other hand, if a complete volume is missing, mysql would start with an empty data dir and reinstall the system databases. Is it possible that the host filesystem was corrupted?

I talked to Mariadb and mysql people and it seems I did not run the database engine’s initialisation script which mysql-install-db. It creates the remaining system database files needed for Mariadb to start.
So the mount was done correctly, the contents were incomplete.