Public Repository

Last pushed: 3 years ago
Short Description
Mariadb on Centos 7
Full Description

Nothing special just a simple Mariadb on Centos 7 with password in the Dockerfile.


# Default stuffs
FROM centos

# Install mariadb-server and set up the database directory.    
RUN yum install mariadb-server -y && mysql_install_db --user=mysql --ldata=/var/lib/mysql/

# Drop the anonymous users and disable root remote access. Drop the test database and create the root user that can only connect from the docker host.
RUN mysqld_safe --nowatch && sleep 2 && mysql -e "drop user ''@localhost;drop user ''@$(echo $HOSTNAME);drop user 'root'@$(echo $HOSTNAME);drop database test;GRANT ALL PRIVILEGES ON *.* TO root IDENTIFIED BY 'root' WITH GRANT OPTION;select user,host,password from mysql.user;" && mysqladmin shutdown

# Expose the magic port.

# Start the database process.
CMD mysqld_safe

Start with:

docker run -d --restart="always" -p --name mariadb cael/mariadb

Connect to the database with:

mysql -h -u root --password=root
Docker Pull Command