HUB
Sign inSign up

codmedialert/mysql

By codmedialert

•Updated about 11 years ago

Image
0

484

codmedialert/mysql repository overview

Container Variables:

Set Variables: The container is built to allow several configurable variables to be passed in at runtime. The values are as follows:*

MYSQL_USER - This is the superuser account that will be allowed to create/alter databases in the instance. Default is root. MYSQL_PASS - This will set the MySQL SuperUser/Root Password. MYSQL_CLIENT - This is the client address space that the connections to the mysql server will be coming from. MYSQL_DB - The name of the MySQL DB that will be created. APP_USER - The username that the Application will use in order to connect to the MySQL DB. APP_PASS - The password of the user that the Application uses to connect to the MySQL DB. CREATEDB - This is a toggle that tells the server to initialize a new database or just allow superuser connections from other servers. (true/false) Default Values: The configurable variable above are set in the Dockerfile to hold the following default values:*

MYSQL_USER = root MYSQL_PASS = PAssw0rd MYSQL_CLIENT = 172.17.%.% MYSQL_DB = testapp APP_USER = testuser APP_PASS = testpass CREATEDB = false

MODE VALUES:

There are 2 startup modes for this server, toggled by the CREATEDB variable. By default CREATEDB is set to false.

CREATEDB=false - In this mode, no new database will be configured, instead the values MYSQL_USER, MYSQL_PASS, and MYSQL_CLIENT will be used to set a grant to allow connections from the remote IP(s) specified in MYSQL_CLIENT variable to the MYSQL_USER using the MYSQL_PASS. This will effectivly do a: GRANT ALL PRIVILEGES ON . TO 'MYSQL_USER'@'MYSQL_CLIENT' IDENTIFIED BY MYSQL_PASS WITH GRANT OPTION;

CREATEDB=true - In this mode, mysql will start up and create a new database specified by the variable MYSQL_DB, it will then construct and run the following grant statement' 'GRANT ALL PRIVILEGES ON MYSQL_DB.* TO 'APP_USER'@'MYSQL_CLIENT' IDENTIFIED BY APP_PASS;

Hense the App user, will have full permissions to the app database that was just created and nothing else. No external grants will be set.

  1. To run docker:

docker run -it -d --name mysql /directory:/var/lib/mysql -p 3306:3306 imageName

  1. To create database:

docker run -it --rm --name mysql -h mysql -v /root/mysql/mysqldata:/var/lib/mysql -e MYSQL_PASS='password' -e MYSQL_DB='wordpress' -e APP_USER='wpadmin' -e APP_PASS='testpass' -e MYSQL_CLIENT='%' mysql:v51

Tag summary

Content type

Image

Digest

sha256:df592164e…

Size

94.9 MB

Last updated

about 11 years ago

docker pull codmedialert/mysql