This README is outdated. Soon to be updated.
Out-of-the-box Ubuntu image (14.04 LTS Trusty Tahr) set up to run a MariaDB server.
Building the image
If you don't want to pull the
morganhjk/mariadb image from the [automated build repository]
(https://registry.hub.docker.com/u/morganhjk/mariadb/) on the [Docker Hub Registry]
(https://registry.hub.docker.com/), you can clone the [repository on GitHub]
(https://github.com/morganhjk/docker-mariadb) and build the image
locally by executing the following command inside the docker-mariadb folder:
docker build -t morganhjk/mariadb .
Running the image
To run a container with the image, execute the following command:
docker run -d --name somedb morganhjk/mariadb
The first time that you run your container, a new user
admin with all privileges
will be created in MariaDB with a random password. To get the password, check the logs
of the container by running:
docker logs <CONTAINER_ID>
You will see something like the following:
======================================================================== You can now connect to this MariaDB server using: mysql -uadmin -pxVN33tWOhM3u -h<host> -P<port> Please remember to change the above password as soon as possible! MariaDB user 'root' has no password but only allows local connections. ========================================================================
In this case,
xVN33tWOhM3u is the password assigned to the MariaDB user
Setting a specific password for the admin account
If you want to use a preset password instead of a randomly generated one, you can
set the environment variable
MARIADB_PASS to your specific password when running the container:
docker run -d --name somedb -e MARIADB_PASS="mypass" morganhjk/mariadb
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 --name somedb_data morganhjk/dbdata
This will create a new container to store MariaDB databases and configuration files.
You can specify any name of the container by using the
--name option, which will be used in the next step.
After this you can start your MariaDB image using volumes from the container created above by executing the
docker run -d --name somedb --volumes-from somedb_data morganhjk/mariadb
credit to http://www.tutum.co