Public | Automated Build

Last pushed: 2 years ago
Short Description
Short description is empty for this repo.
Full Description


Base docker image to run a MariaDB database server

MariaDB version

If you want to use MySQL, please check our lastbackend/mysql image:


To create the image lastbackend/mariadb, execute the following command on the lb-docker-mariadb folder:

docker build -t lastbackend/mariadb .

To run the image and bind to port 3306:

docker run -d -p 3306:3306 lastbackend/mariadb

The first time that you run your container, a new random password will be set.
To get the password, check the logs of the container by running:

    docker logs <CONTAINER_ID>

You will see an output like the following:

      --------------------------------- MariaDB -------------------------------
      +-++-+ mysql -uadmin -p rf8DNqbAswqJgj463CsalCD3 -h -h «host» -P «port»
      | LB |
      +-++-+ Please remember to change the above password!

In this case, rf8DNqbAswqJgj463CsalCD3 is the password assigned to the admin user.

Setting a specific password

If you want to use a preset password instead of a random generated one, you can
set the environment variable PASS to your specific password when running the container:

docker run -d -p 3306:3306 -e PASS="password" -e USER="demo" lastbackend/mariadb

      --------------------------------- MariaDB -------------------------------
      | LB | mysql -u demo -p «password» -h «host» -P «port»

In this case, password is the password assigned to the admin user.

If you want to disable password authentication, you can set PASS to **None**

Mounting the database file volume from other containers

One way to persist the database data is to store database files in another container.
To do so, first create a container that holds database files:

docker run -d -v /var/lib/mysql --name db_vol -p 22:22 lastbackend/ubuntu-trusty

This will create a new ssh-enabled container and use its folder /var/lib/mysql to store MariaDB database files.
You can specify any name of the container by using --name option, which will be used in next step.

After this you can start your MariaDB image using volumes in the container created above (put the name of container in --volumes-from)

docker run -d --volumes-from db_vol -p 3306:3306 lastbackend/mariadb


Docker Pull Command
Source Repository

Comments (0)