Public | Automated Build

Last pushed: a month ago
Short Description
MySQL Server based on Ubuntu 14.04
Full Description

Docker MySQL-Server Container (marvambass/mysql)

maintained by MarvAmBass

FAQ - All you need to know about the marvambass Containers

What is it

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

Environment variables and defaults

MySQL Daemon

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

Backup

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

Optional DB & User auto-creation

  • 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

Using the marvambass/mysql Container

Running MySQL

Quickstart

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

Normal

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

Connection

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!

Docker Pull Command
Owner
marvambass
Source Repository

Comments (0)