From d0bb45fa8bac2ff3e5d3dbb84e7c0de16ed17a1e Mon Sep 17 00:00:00 2001 From: Tomas Pizarro Date: Fri, 3 Mar 2017 09:32:45 +0000 Subject: [PATCH 1/5] Add ALLOW_EMPTY_PASSWORD env variable and othe env variables changes --- bitnami/mariadb/10/docker-compose.yml | 2 + bitnami/mariadb/README.md | 76 +++++++++++++++---- .../mariadb/docker-compose-replication.yml | 2 + bitnami/mariadb/docker-compose.yml | 2 + 4 files changed, 69 insertions(+), 13 deletions(-) diff --git a/bitnami/mariadb/10/docker-compose.yml b/bitnami/mariadb/10/docker-compose.yml index 4b695bcb7fef..dc757748ab0f 100644 --- a/bitnami/mariadb/10/docker-compose.yml +++ b/bitnami/mariadb/10/docker-compose.yml @@ -3,6 +3,8 @@ version: '2' services: mariadb: image: 'bitnami/mariadb:10' + environment: + - ALLOW_EMPTY_PASSWORD=yes ports: - '3306:3306' volumes: diff --git a/bitnami/mariadb/README.md b/bitnami/mariadb/README.md index c5a0dc90f695..eefac055a479 100644 --- a/bitnami/mariadb/README.md +++ b/bitnami/mariadb/README.md @@ -10,7 +10,7 @@ # TLDR ```bash -docker run --name mariadb bitnami/mariadb:latest +docker run --name mariadb -e ALLOW_EMPTY_PASSWORD=yes bitnami/mariadb:latest ``` ## Docker Compose @@ -21,6 +21,8 @@ version: '2' services: mariadb: image: 'bitnami/mariadb:latest' + environment: + - ALLOW_EMPTY_PASSWORD=yes ports: - '3306:3306' ``` @@ -69,6 +71,8 @@ version: '2' services: mariadb: image: 'bitnami/mariadb:latest' + environment: + - ALLOW_EMPTY_PASSWORD=yes ports: - '3306:3306' volumes: @@ -97,6 +101,7 @@ Use the `--network app-tier` argument to the `docker run` command to attach the ```bash $ docker run -d --name mariadb-server \ + -e ALLOW_EMPTY_PASSWORD=yes \ --network app-tier \ bitnami/mariadb:latest ``` @@ -125,6 +130,8 @@ networks: services: mariadb: image: 'bitnami/mariadb:latest' + environment: + - ALLOW_EMPTY_PASSWORD=yes networks: - app-tier myapp: @@ -135,7 +142,7 @@ services: > **IMPORTANT**: > -> 1. Please update the **YOUR_APPLICATION_IMAGE_** placeholder in the above snippet with your application image +> 1. Please update the `YOUR_APPLICATION_IMAGE` placeholder in the above snippet with your application image > 2. In your application container, use the hostname `mariadb` to connect to the MariaDB server Launch the containers using: @@ -148,7 +155,12 @@ $ docker-compose up -d ## Setting the root password on first run -Passing the `MARIADB_ROOT_PASSWORD` environment variable when running the image for the first time will set the password of the root user to the value of `MARIADB_ROOT_PASSWORD`. +The root user and password can easily be setup with the Bitnami MariaDB Docker image using the following environment variables: + + - `MARIADB_ROOT_USER`: The database admin user. Defaults to `root`. + - `MARIADB_ROOT_PASSWORD`: The database admin user password. No defaults. + +Passing the `MARIADB_ROOT_PASSWORD` environment variable when running the image for the first time will set the password of the `MARIADB_ROOT_USER` user to the value of `MARIADB_ROOT_PASSWORD`. ```bash docker run --name mariadb -e MARIADB_ROOT_PASSWORD=password123 bitnami/mariadb:latest @@ -168,7 +180,29 @@ services: - MARIADB_ROOT_PASSWORD=password123 ``` -**Warning** The `root` user is always created with remote access. It's suggested that the `MARIADB_ROOT_PASSWORD` env variable is always specified to set a password for the `root` user. +**Warning** The `MARIADB_ROOT_USER` user is always created with remote access. It's suggested that the `MARIADB_ROOT_PASSWORD` env variable is always specified to set a password for the `MARIADB_ROOT_USER` user. In case you want to allow the `MARIADB_ROOT_USER` user to access the database without a password set the environment variable `ALLOW_EMPTY_PASSWORD=yes`. **This is recommended only for development**. + +## Allowing empty passwords + +By default the MariaDB image expects that all the available password to be set. In order to allow empty passwords, it is necessary to set the `ALLOW_EMPTY_PASSWORD` env variable. This env variable is only recommended for testing or development purpose. We strongly recommend to specify the `MARIADB_ROOT_PASSWORD` for any other scenario. + +```bash +docker run --name mariadb -e ALLOW_EMPTY_PASSWORD=yes bitnami/mariadb:latest +``` + +or using Docker Compose: + +```yaml +version: '2' + +services: + mariadb: + image: 'bitnami/mariadb:latest' + ports: + - '3306:3306' + environment: + - ALLOW_EMPTY_PASSWORD=yes +``` ## Creating a database on first run @@ -189,6 +223,7 @@ services: ports: - '3306:3306' environment: + - ALLOW_EMPTY_PASSWORD=yes - MARIADB_DATABASE=my_database ``` @@ -198,7 +233,9 @@ You can create a restricted database user that only has permissions for the data ```bash docker run --name mariadb \ - -e MARIADB_USER=my_user -e MARIADB_PASSWORD=my_password \ + -e ALLOW_EMPTY_PASSWORD=yes \ + -e MARIADB_USER=my_user \ + -e MARIADB_PASSWORD=my_password \ -e MARIADB_DATABASE=my_database \ bitnami/mariadb:latest ``` @@ -214,12 +251,13 @@ services: ports: - '3306:3306' environment: + - ALLOW_EMPTY_PASSWORD=yes - MARIADB_USER=my_user - MARIADB_PASSWORD=my_password - MARIADB_DATABASE=my_database ``` -**Note!** The `root` user will still be created with remote access. Please ensure that you have specified a password for the `root` user using the `MARIADB_ROOT_PASSWORD` env variable. +**Note!** The `root` user will still be created with remote access if you set the `ALLOW_EMPTY_PASSWORD` env variable. Please provide the `MARIADB_ROOT_PASSWORD` env variable instead if you want to set a password for the `root` user. ## Setting up a replication cluster @@ -230,8 +268,8 @@ A **zero downtime** MariaDB master-slave [replication](https://dev.mysql.com/doc - `MARIADB_REPLICATION_PASSWORD`: The replication users password. No defaults. - `MARIADB_MASTER_HOST`: Hostname/IP of replication master (slave parameter). No defaults. - `MARIADB_MASTER_PORT`: Server port of the replication master (slave parameter). Defaults to `3306`. - - `MARIADB_MASTER_USER`: User on replication master with access to `MARIADB_DATABASE` (slave parameter). Defaults to `root` - - `MARIADB_MASTER_PASSWORD`: Password of user on replication master with access to `MARIADB_DATABASE` (slave parameter). No defaults. + - `MARIADB_MASTER_ROOT_USER`: User on replication master with access to `MARIADB_DATABASE` (slave parameter). Defaults to `root` + - `MARIADB_MASTER_ROOT_PASSWORD`: Password of user on replication master with access to `MARIADB_DATABASE` (slave parameter). No defaults. In a replication cluster you can have one master and zero or more slaves. When replication is enabled the master node is in read-write mode, while the slaves are in read-only mode. For best performance its advisable to limit the reads to the slaves. @@ -264,15 +302,15 @@ docker run --name mariadb-slave --link mariadb-master:master \ -e MARIADB_REPLICATION_USER=my_repl_user \ -e MARIADB_REPLICATION_PASSWORD=my_repl_password \ -e MARIADB_MASTER_HOST=master \ - -e MARIADB_MASTER_USER=my_user \ - -e MARIADB_MASTER_PASSWORD=my_password \ + -e MARIADB_MASTER_ROOT_USER=my_user \ + -e MARIADB_MASTER_ROOT_PASSWORD=my_password \ -e MARIADB_USER=my_user \ -e MARIADB_PASSWORD=my_password \ -e MARIADB_DATABASE=my_database \ bitnami/mariadb:latest ``` -In the above command the container is configured as a `slave` using the `MARIADB_REPLICATION_MODE` parameter. The `MARIADB_MASTER_HOST`, `MARIADB_MASTER_USER` and `MARIADB_MASTER_PASSWORD` parameters are used by the slave to connect to the master and take a dump of the existing data in the database identified by `MARIADB_DATABASE`. The replication user credentials are specified using the `MARIADB_REPLICATION_USER` and `MARIADB_REPLICATION_PASSWORD` parameters and should be the same as the one specified on the master. +In the above command the container is configured as a `slave` using the `MARIADB_REPLICATION_MODE` parameter. The `MARIADB_MASTER_HOST`, `MARIADB_MASTER_ROOT_USER` and `MARIADB_MASTER_ROOT_PASSWORD` parameters are used by the slave to connect to the master and take a dump of the existing data in the database identified by `MARIADB_DATABASE`. The replication user credentials are specified using the `MARIADB_REPLICATION_USER` and `MARIADB_REPLICATION_PASSWORD` parameters and should be the same as the one specified on the master. > **Note**! The cluster only replicates the database specified in the `MARIADB_DATABASE` parameter. @@ -310,8 +348,8 @@ services: - MARIADB_REPLICATION_PASSWORD=repl_password - MARIADB_MASTER_HOST=mariadb-master - MARIADB_MASTER_PORT=3306 - - MARIADB_MASTER_USER=my_user - - MARIADB_MASTER_PASSWORD=my_password + - MARIADB_MASTER_ROOT_USER=my_user + - MARIADB_MASTER_ROOT_PASSWORD=my_password - MARIADB_ROOT_PASSWORD=root_password - MARIADB_USER=my_user - MARIADB_PASSWORD=my_password @@ -362,6 +400,8 @@ version: '2' services: mariadb: image: 'bitnami/mariadb:latest' + environment: + - ALLOW_EMPTY_PASSWORD=yes ports: - '3306:3306' volumes: @@ -460,6 +500,8 @@ version: '2' services: mariadb: image: 'bitnami/mariadb:latest' + environment: + - ALLOW_EMPTY_PASSWORD=yes ports: - '3306:3306' volumes: @@ -493,6 +535,7 @@ docker rm -v mariadb or using Docker Compose: + ```bash docker-compose rm -v mariadb ``` @@ -512,6 +555,13 @@ docker-compose start mariadb ``` # Notable Changes +## 10.1.21-r2 + +- `MARIADB_MASTER_USER` has been renamed to `MARIADB_MASTER_ROOT_USER` +- `MARIADB_MASTER_PASSWORD` has been renamed to `MARIADB_MASTER_ROOT_PASSWORD` +- `MARIADB_ROOT_USER` has been added to the available env variables. It can be used to specify the admin user. +- `ALLOW_EMPTY_PASSWORD` has been added to the available env variables. It can be used to allow blank passwords for MariaDB. +- By default the MariaDB image requires a root password to start. You can specify it using the `MARIADB_ROOT_PASSWORD` env variable or disable this requirement by setting the `ALLOW_EMPTY_PASSWORD` env variable to `yes` (testing or development scenarios). ## 10.1.13-r0 diff --git a/bitnami/mariadb/docker-compose-replication.yml b/bitnami/mariadb/docker-compose-replication.yml index 5e5d7a17c5f7..dc4e903194dc 100644 --- a/bitnami/mariadb/docker-compose-replication.yml +++ b/bitnami/mariadb/docker-compose-replication.yml @@ -8,6 +8,7 @@ services: volumes: - 'mariadb_master_data:/bitnami/mariadb' environment: + - ALLOW_EMPTY_PASSWORD=yes - MARIADB_REPLICATION_MODE=master - MARIADB_REPLICATION_USER=repl_user - MARIADB_REPLICATION_PASSWORD=repl_password @@ -21,6 +22,7 @@ services: depends_on: - mariadb-master environment: + - ALLOW_EMPTY_PASSWORD=yes - MARIADB_REPLICATION_MODE=slave - MARIADB_REPLICATION_USER=repl_user - MARIADB_REPLICATION_PASSWORD=repl_password diff --git a/bitnami/mariadb/docker-compose.yml b/bitnami/mariadb/docker-compose.yml index 6e77e756dcbb..99fb68047f1a 100644 --- a/bitnami/mariadb/docker-compose.yml +++ b/bitnami/mariadb/docker-compose.yml @@ -3,6 +3,8 @@ version: '2' services: mariadb: image: 'bitnami/mariadb:latest' + environment: + - ALLOW_EMPTY_PASSWORD=yes ports: - '3306:3306' volumes: From 1de91a82f4f5fc1c268d6fc54ba6eecc3fe81cb8 Mon Sep 17 00:00:00 2001 From: Tomas Pizarro Date: Fri, 3 Mar 2017 10:32:54 +0000 Subject: [PATCH 2/5] Fixed typos and improve wording --- bitnami/mariadb/README.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/bitnami/mariadb/README.md b/bitnami/mariadb/README.md index eefac055a479..792804424d95 100644 --- a/bitnami/mariadb/README.md +++ b/bitnami/mariadb/README.md @@ -184,7 +184,7 @@ services: ## Allowing empty passwords -By default the MariaDB image expects that all the available password to be set. In order to allow empty passwords, it is necessary to set the `ALLOW_EMPTY_PASSWORD` env variable. This env variable is only recommended for testing or development purpose. We strongly recommend to specify the `MARIADB_ROOT_PASSWORD` for any other scenario. +By default the MariaDB image expects all the available passwords to be set. In order to allow empty passwords, it is necessary to set the `ALLOW_EMPTY_PASSWORD` env variable. This env variable is only recommended for testing or development purposes. We strongly recommend specifying the `MARIADB_ROOT_PASSWORD` for any other scenario. ```bash docker run --name mariadb -e ALLOW_EMPTY_PASSWORD=yes bitnami/mariadb:latest @@ -257,7 +257,7 @@ services: - MARIADB_DATABASE=my_database ``` -**Note!** The `root` user will still be created with remote access if you set the `ALLOW_EMPTY_PASSWORD` env variable. Please provide the `MARIADB_ROOT_PASSWORD` env variable instead if you want to set a password for the `root` user. +**Note!** The `root` user will be created with remote access and without a password if `ALLOW_EMPTY_PASSWORD` is enabled. Please provide the `MARIADB_ROOT_PASSWORD` env variable instead if you want to set a password for the `root` user. ## Setting up a replication cluster @@ -279,7 +279,7 @@ The first step is to start the MariaDB master. ```bash docker run --name mariadb-master \ - -e MARIADB_ROOT_PASSWORD=root_password \ + -e MARIADB_ROOT_PASSWORD=master_root_password \ -e MARIADB_REPLICATION_MODE=master \ -e MARIADB_REPLICATION_USER=my_repl_user \ -e MARIADB_REPLICATION_PASSWORD=my_repl_password \ @@ -297,13 +297,12 @@ Next we start a MariaDB slave container. ```bash docker run --name mariadb-slave --link mariadb-master:master \ - -e MARIADB_ROOT_PASSWORD=root_password \ -e MARIADB_REPLICATION_MODE=slave \ -e MARIADB_REPLICATION_USER=my_repl_user \ -e MARIADB_REPLICATION_PASSWORD=my_repl_password \ -e MARIADB_MASTER_HOST=master \ - -e MARIADB_MASTER_ROOT_USER=my_user \ - -e MARIADB_MASTER_ROOT_PASSWORD=my_password \ + -e MARIADB_MASTER_ROOT_USER=root \ + -e MARIADB_MASTER_ROOT_PASSWORD=master_root_password \ -e MARIADB_USER=my_user \ -e MARIADB_PASSWORD=my_password \ -e MARIADB_DATABASE=my_database \ @@ -332,7 +331,7 @@ services: - MARIADB_REPLICATION_MODE=master - MARIADB_REPLICATION_USER=repl_user - MARIADB_REPLICATION_PASSWORD=repl_password - - MARIADB_ROOT_PASSWORD=root_password + - MARIADB_ROOT_PASSWORD=master_root_password - MARIADB_USER=my_user - MARIADB_PASSWORD=my_password - MARIADB_DATABASE=my_database @@ -348,9 +347,8 @@ services: - MARIADB_REPLICATION_PASSWORD=repl_password - MARIADB_MASTER_HOST=mariadb-master - MARIADB_MASTER_PORT=3306 - - MARIADB_MASTER_ROOT_USER=my_user - - MARIADB_MASTER_ROOT_PASSWORD=my_password - - MARIADB_ROOT_PASSWORD=root_password + - MARIADB_MASTER_ROOT_USER=root + - MARIADB_MASTER_ROOT_PASSWORD=master_root_password - MARIADB_USER=my_user - MARIADB_PASSWORD=my_password - MARIADB_DATABASE=my_database From d493581a727dafe79cd41a31484292b6aea0df7e Mon Sep 17 00:00:00 2001 From: Tomas Pizarro Date: Fri, 3 Mar 2017 10:35:11 +0000 Subject: [PATCH 3/5] Fixed typo --- bitnami/mariadb/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitnami/mariadb/README.md b/bitnami/mariadb/README.md index 792804424d95..6515bf3219f4 100644 --- a/bitnami/mariadb/README.md +++ b/bitnami/mariadb/README.md @@ -184,7 +184,7 @@ services: ## Allowing empty passwords -By default the MariaDB image expects all the available passwords to be set. In order to allow empty passwords, it is necessary to set the `ALLOW_EMPTY_PASSWORD` env variable. This env variable is only recommended for testing or development purposes. We strongly recommend specifying the `MARIADB_ROOT_PASSWORD` for any other scenario. +By default the MariaDB image expects all the available passwords to be set. In order to allow empty passwords, it is necessary to set the `ALLOW_EMPTY_PASSWORD=yes` env variable. This env variable is only recommended for testing or development purposes. We strongly recommend specifying the `MARIADB_ROOT_PASSWORD` for any other scenario. ```bash docker run --name mariadb -e ALLOW_EMPTY_PASSWORD=yes bitnami/mariadb:latest From 8e5812e41b0e7ed0e8ddda6d9d1334340cec87a0 Mon Sep 17 00:00:00 2001 From: Tomas Pizarro Date: Fri, 3 Mar 2017 10:54:32 +0000 Subject: [PATCH 4/5] Add MARIADB_ROOT_PASSWORD to slave node in cluster example --- bitnami/mariadb/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bitnami/mariadb/README.md b/bitnami/mariadb/README.md index 6515bf3219f4..eb984d5a5d88 100644 --- a/bitnami/mariadb/README.md +++ b/bitnami/mariadb/README.md @@ -297,6 +297,7 @@ Next we start a MariaDB slave container. ```bash docker run --name mariadb-slave --link mariadb-master:master \ + -e MARIADB_ROOT_PASSWORD=slave_root_password \ -e MARIADB_REPLICATION_MODE=slave \ -e MARIADB_REPLICATION_USER=my_repl_user \ -e MARIADB_REPLICATION_PASSWORD=my_repl_password \ @@ -345,6 +346,7 @@ services: - MARIADB_REPLICATION_MODE=slave - MARIADB_REPLICATION_USER=repl_user - MARIADB_REPLICATION_PASSWORD=repl_password + - MARIADB_ROOT_PASSWORD=slave_root_password - MARIADB_MASTER_HOST=mariadb-master - MARIADB_MASTER_PORT=3306 - MARIADB_MASTER_ROOT_USER=root From 811bb8bdb6e66590c096feea3340e9d9c1fa47dd Mon Sep 17 00:00:00 2001 From: Tomas Pizarro Date: Fri, 3 Mar 2017 11:02:05 +0000 Subject: [PATCH 5/5] Remove MARIADB_MASTER_ROOT_USER env var from cluster example --- bitnami/mariadb/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/bitnami/mariadb/README.md b/bitnami/mariadb/README.md index eb984d5a5d88..f018dd835cac 100644 --- a/bitnami/mariadb/README.md +++ b/bitnami/mariadb/README.md @@ -302,7 +302,6 @@ docker run --name mariadb-slave --link mariadb-master:master \ -e MARIADB_REPLICATION_USER=my_repl_user \ -e MARIADB_REPLICATION_PASSWORD=my_repl_password \ -e MARIADB_MASTER_HOST=master \ - -e MARIADB_MASTER_ROOT_USER=root \ -e MARIADB_MASTER_ROOT_PASSWORD=master_root_password \ -e MARIADB_USER=my_user \ -e MARIADB_PASSWORD=my_password \ @@ -349,7 +348,6 @@ services: - MARIADB_ROOT_PASSWORD=slave_root_password - MARIADB_MASTER_HOST=mariadb-master - MARIADB_MASTER_PORT=3306 - - MARIADB_MASTER_ROOT_USER=root - MARIADB_MASTER_ROOT_PASSWORD=master_root_password - MARIADB_USER=my_user - MARIADB_PASSWORD=my_password