Loading...
 

MariaDB

Docker Image Notes

  • Pull the image
    docker pull mariadb:latest
  • Run the container. A few things to note here:
    • 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
      • Without SeLinux
        docker run --name <container_name> -v /some/dir/backups:/backups -v /some/dir/data:/var/lib/mysql -e MYSQL_RANDOM_ROOT_PASSWORD=yes --restart=unless-stopped --net=bridge -d mariadb:<tag>
      • With SeLinux
        docker run --name <container_name> -v /some/dir/backups:/backups:Z -v /some/dir/data:/var/lib/mysql:Z -e MYSQL_RANDOM_ROOT_PASSWORD=yes --restart=unless-stopped --net=bridge -d mariadb:<tag>
  • 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
    '/usr/bin/mysqladmin' -u root password 'new-password'
    '/usr/bin/mysqladmin' -u root -h  password 'new-password'
    GENERATED ROOT PASSWORD: uo5ielahtea6aejooYiem1shaaG3eix8

Show php error messages