Docker Image Notes

You may want to mount a volume from the host to dump your SQL backup to if desired. I also do this for the mysql files

you should not set the MYSQL_ROOT_PASSWORD variable when creating the docker container because that environment variable (password) will be visible to any linked containers. Instead allow the container to generate a random root password and then connect to the container and change the root password manually

If you are using docker user namespaces, make sure that you set the UID/GID of the host volumes being mounted inside the container to the correct values based on your SUBUID/SUBGID. In my case the SUBUID/SUBGID was 100000:100000. So I set the owner of the volume to 100999 (999 being the UID of the mysql user inside of the container), and set the group for the volume to 100000 (which ends up being the root user inside the container).

If you are using SeLinux you should add ':Z' to the end of each volume mount which should set the SeLinux file context for properly for you

After the container has started, wait a minute for it to initialize MariaDB. Then print the logs (docker logs <container_name>) and 'grep -i root'. You should see something that looks like this. Get to a 'bash' shell in the container and change the root password to whatever you like