maintained by MarvAmBass
FAQ - All you need to know about the marvambass Containers
This Dockerfile (available as marvambass/mysql) gives you a completly running SQL-Server. It is also possible to configure a auto mysqldump mechanism.
For Configuration of the Server you use environment Variables.
It's based on the ubuntu:14.04 Image
View in Docker Registry marvambass/mysql
View in GitHub MarvAmBass/docker-mysql
The daemon stores the database data beneath: /var/lib/mysql
- ADMIN_USER
- no default - needed only when backup enabled or for mysql initialisation
- ADMIN_PASSWORD
- no default - needed only when backup enabled or for mysql initialisation
- BIND_ADDRESS
- default: 0.0.0.0
This is totaly optional - backup is disabled by default!
In default it stores it's dumps beneath: /var/mysql-backup
- BACKUP_ENABLED
- default null, needs 'yes' to be enabled
- BACKUP_CRON_TIME
- default: 0 * * * * (hourly mysqldumps) - uses normal cron syntax
- BACKUP_PATH
- default: /var/mysql-backup - the place to store the mysqldumps
- DB_NAME
- no default - required if you want the auto create a database with user
- DB_USER
- no default - required if you want the auto create a database with user
- DB_PASSWORD
- no default - required if you want the auto create a database with user
The following command starts a non persistent mysql database which will be lost after the container is deleted.
docker run -d --name mysql -e 'ADMIN_USER=dbadmin' -e 'ADMIN_PASSWORD=adminpw' -e 'DB_NAME=testdb' -e 'DB_USER=testdbuser' -e 'DB_PASSWORD=usersecret' marvambass/mysql
For the first start you'll need to provide the ADMIN_USER and ADMIN_PASSWORD variables
docker run -d --name mysql \
-e 'ADMIN_USER=dbadmin' -e 'ADMIN_PASSWORD=pa55worD!' \
-e 'BIND_ADDRESS=192.0.3.33' \
-e 'BACKUP_ENABLED=yes' -e 'BACKUP_CRON_TIME=0 * * * *' \
-p 3306:3306 \
-v /tmp/mysqldata:/var/lib/mysql \
-v /tmp/mysqlbackup:/var/mysql-backup \
marvambass/mysql
you need to provide the credentials only if you start the container for the first time (so it can initialize a new Database) or if you use the internal mysqldump backup mechanism
Now you can connect to the MySQL Server via the normal mysql-client cli:
mysql -u $ADMIN_USER -p -h $(docker inspect --format='{{.NetworkSettings.IPAddress}}' $CONTAINER_ID)
You could also use my marvambass/phpmyadmin container and link them together.
You only link phpmyadmin to mysql container if you want to use phpmyadmin!