Painted-Fox/docker-mariadb — pull request #1 by niclashoyer (2014-01-05 10:21:40+00:00)
Title: Added environment variables for database user and password

Added optional environment variables `USER` and `PASSWORD` to specify user and password used for the database upon running the container. This is very useful when linking containers to each other:

First start the database container (I'll name it `sql`):

```bash
docker run -d -name sql -e PASSWORD=(pwgen -s -1 16) -e USER=admin niclashoyer/mariadb
```

Then spin up another container with a link (`sql` linked as `db`):

```bash
docker run -t -i -link sql:db ubuntu bash
```

Using the environment variables it is now possible to connect to the database container using the provided password:

```bash
apt-get install -y mysql-client
mysql -u "$DB_ENV_USER" -p"$DB_ENV_PASSWORD" -h "$DB_PORT_3306_TCP_ADDR" -P "$DB_PORT_3306_TCP_PORT"
```