Public Repository

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

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

Dockerfile:

# Default stuffs
FROM centos
MAINTAINER matej@udebilov.net

# 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.
EXPOSE 3306

# Start the database process.
CMD mysqld_safe

Start with:

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

Connect to the database with:

mysql -h 127.0.0.1 -u root --password=root
Docker Pull Command
Owner
cael

Comments (0)