Public | Automated Build

Last pushed: a year ago
Short Description
Base MySQL image
Full Description

MySQL base image

This repository contains tha definitions of the base MySQL images that we use in our projects.

The images are inspired by the official tutum/mysql.

Versions MySQL

5.6

Run example

$ docker run -d treedom/mysql:5.6

User and password

By default the user name is admin and the password is generated randomly at runtime.

To know the assigned password type:

$ docker logs <CONTAINER ID>

You can control the password value through the env variable MYSQL_PASS

Default database

The service does not create a new database when launched.

If you want that to happen you can provide a database name through the env variable ON_CREATE_DB

Volumes

The service containers will expose two volumes on

  • /etc/mysql
  • /var/lib/mysql

so you can use it to provide data volumes.

If you want to persist your development db state in your host you can mount a host folder to the /var/lib/mysql path

$ docker run -d -v /path/in/host:/var/lib/mysql treedom/mysql:5.6

By the same way you can control the service configuration using the /etc/mysql mount point

Gotcha

By default the MySQL service is started with the skip_name_resolve flag to cover more network configurations.

However if you want to talk to the service at full speed you have to call it using is real IP address.

This means that if you are using any sort of name resolution service (DNS, etc...) to find MySQL through an hostname

# PHP - example - don NOT do this...
$mysqli = new mysqli("mysql-hostname", ..., ..., ...);

you should resolve your hostname to an IP before the connection to MySQL

# PHP - do this
$mysqli = new mysqli(gethostbyname("mysql-hostname"), ..., ..., ...);
Docker Pull Command
Owner
treedom

Comments (0)