From 78a717c05f2fe29afbdbc93209a685eafbb595e8 Mon Sep 17 00:00:00 2001 From: Yngve Svendsen Date: Sat, 21 Mar 2015 07:41:49 -0400 Subject: [PATCH 01/12] Merge from the README.md of the mysql/mysql-server image. --- mysql/content.md | 112 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 88 insertions(+), 24 deletions(-) diff --git a/mysql/content.md b/mysql/content.md index 30a22a25f..16abf3660 100644 --- a/mysql/content.md +++ b/mysql/content.md @@ -1,49 +1,113 @@ +%%LOGO%% + # What is MySQL? -MySQL is (as of March 2014) the world's second most widely used open-source relational database management system (RDBMS). It is named after co-founder Michael Widenius's daughter, My. The SQL phrase stands for Structured Query Language. +MySQL is the world's most popular open source database. With its proven performance, reliability and ease-of-use, MySQL has become the leading database choice for web-based applications, covering the entire range from personal projects and websites, via e-commerce and information services, all the way to high profile web properties including Facebook, Twitter, YouTube, Yahoo! and many more. -MySQL is a popular choice of database for use in web applications, and is a central component of the widely used LAMP open source web application software stack (and other 'AMP' stacks). LAMP is an acronym for "Linux, Apache, MySQL, Perl/PHP/Python." Free-software-open source projects that require a full-featured database management system often use MySQL. - -Oracle Corporation and/or affiliates own the copyright and trademark for MySQL. - -> [wikipedia.org/wiki/MySQL](https://en.wikipedia.org/wiki/MySQL) - -%%LOGO%% +For more information and related downloads for MySQL Server and other MySQL products, please visit [www.mysql.com](http://www.mysql.com). # How to use this image -## start a `%%REPO%%` server instance +## Start a `%%REPO%%` server instance - docker run --name some-%%REPO%% -e MYSQL_ROOT_PASSWORD=mysecretpassword -d %%REPO%% +Starting a MySQL instance is simple: -This image includes `EXPOSE 3306` (the standard MySQL port), so container linking will make it automatically available to the linked containers (as the following examples illustrate). + docker run --name some-%%REPO%% -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag -## connect to it from an application +... where `some-%%REPO%%` is the name you want to assign to your container, `my-secret-pw` is the password to be set for the MySQL root user and `tag` is the tag specifying the MySQL version you want. See the list above for relevant tags. - docker run --name some-app --link some-%%REPO%%:mysql -d application-that-uses-mysql +## Connect to MySQL from an application in another Docker container -## ... or via `mysql` +This image exposes the standard MySQL port (3306), so container linking makes the MySQL instance available to other application containers. Start your application container like this in order to link it to the MySQL container: + + docker run --name some-app --link some-%%REPO%%:mysql -d app-that-uses-mysql + +## Connect to MySQL from the MySQL command line client + +The following command starts another MySQL container instance and runs the `mysql` command line client against your original MySQL container, allowing you to execute SQL statements against your database instance: docker run -it --link some-%%REPO%%:mysql --rm %%REPO%% sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' + +... where `some-%%REPO%%` is the name of your original MySQL Server container. + +More information about the MySQL command line client can be found in the [MySQL documentation](http://dev.mysql.com/doc/en/mysql.html) + +## Container shell access and viewing MySQL logs + +The `docker exec` command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your `%%REPO%%` container: + + docker exec -it some-%%REPO%% bash + +The MySQL Server log is located at `/var/log/mysql/error.log` inside the container, and the following command line from a shell inside the container will let you inspect it: + + more /var/log/mysql/error.log + +## Using a custom MySQL configuration file + +The MySQL startup configuration is specified in the file `/etc/mysql/my.cnf`. If you want to customize this configuration for your own purposes, you can create your alternative configuration file in a directory on the host machine and then mount this file in the appropriate location inside the `%%REPO%%` container, effectively replacing the standard configuration file. + +If you want to base your changes on the standard configuration file, start your `%%REPO` container in the standard way described above, then do: + + docker exec -it some-%%REPO%% cat /etc/mysql/my.cnf > /my/custom/config-file + +... where `/my/custom/config-file` is the path and name of the new configuration file. Then start a new `%%REPO%%` container like this: + + docker run --name new-conf-%%REPO%% -v /my/custom/config-file:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag + +This will start a new container `new-conf-%%REPO%%` where the MySQL instance uses the startup options specified in `/my/custom/config-file`. + +Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to your new config file so that the container will be allowed to mount it: + + chcon -Rt svirt_sandbox_file_t /my/custom/config-file ## Environment Variables -The `%%REPO%%` image uses several environment variables which are easy to miss. While not all the variables are required, they may significantly aid you in using the image. +When you start the `%%REPO%%` image, you can adjust the configuration of the MySQL instance by passing one or more environment variables on the `docker run` command line. Do note that none of the variables below will have any effect if you start the container with a data directory that already contains a database: any pre-existing database will always be left untouched on container startup. -### `MYSQL_ROOT_PASSWORD` +## `MYSQL_ROOT_PASSWORD` -This is the one environment variable that is required. This environment variable should be what you want to set the password for the `root` user to be. In the above example, it is being set to "`mysecretpassword`". - -### `MYSQL_USER`, `MYSQL_PASSWORD` - -These optional environment variables are used in conjunction to both create a new user and set that user's password, which will subsequently be granted all permissions for the database specified by the optional `MYSQL_DATABASE` variable. Note that if you only have one of these two environment variables, then neither will do anything -- these two are required to be used in conjunction with one another. - -Additionally, there is no need to specify `MYSQL_USER` with `root`, as the `root` user already exists by default, and the password of that user is controlled by `MYSQL_ROOT_PASSWORD` (see above). +This variable is mandatory and specifies the password that will be set for the MySQL `root` superuser account. In the above example, it was set to `my-secret-pw`. ### `MYSQL_DATABASE` -This optional environment variable denotes the name of a database to create. If a user/password was supplied (via the `MYSQL_USER` and `MYSQL_PASSWORD` environment variables) then that user will be granted (via `GRANT ALL`) access to this database. +This variable is optional and allows you to specify the name of a database to be created on image startup. If a user/password was supplied (see below) then that user will be granted superuser access ([corresponding to `GRANT ALL`](http://dev.mysql.com/doc/en/adding-users.html)) to this database. + +### `MYSQL_USER`, `MYSQL_PASSWORD` + +These variables are optional, used in conjunction to create a new user and to set that user's password. This user will be granted superuser permissions (see above) for the database specified by the `MYSQL_DATABASE` variable. Both variables are required for a user to be created. + +Do note that there is no need to use this mechanism to create the root superuser, that user gets created by default with the password specified by the `MYSQL_ROOT_PASSWORD` variable. + +### `MYSQL_ALLOW_EMPTY_PASSWORD` + +Set to `yes` to allow the container to be started with a blank password for the root user. *NOTE*: Setting this variable to `yes` is not recommended unless you really know what you are doing, since this will leave your MySQL instance completely unprotected, allowing anyone to gain complete superuser access. # Caveats +## Where to Store Data + +Important note: There are several ways to store data used by applications that run in Docker containers. We encourage users of the `%%REPO%%` images to familiarize themselves with the options available, including: + +- Let Docker manage the storage of your database data [by writing the database files to disk on the host system using its own internal volume management](https://docs.docker.com/userguide/dockervolumes/#adding-a-data-volume). This is the default and is easy and fairly transparent to the user. The downside is that the files may be hard to locate for tools and applications that run directly on the host system, i.e. outside containers. +- Create a data directory on the host system (outside the container) and [mount this to a directory visible from inside the container](https://docs.docker.com/userguide/dockervolumes/#mount-a-host-directory-as-a-data-volume). This places the database files in a known location on the host system, and makes it easy for tools and applications on the host system to access the files. The downside is that the user needs to make sure that the directory exists, and that e.g. directory permissions and other security mechanisms on the host system are set up correctly. + +The Docker documentation is a good starting point for understanding the different storage options and variations, and there are multiple blogs and forum postings that discuss and give advice in this area. We will simply show the basic procedure here for the latter option above: + +1. Create a data directory on a suitable volume on your host system, e.g. `/my/own/datadir`. +2. Start your `%%REPO%%` container like this: + + docker run --name some-%%REPO%% -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag + +The `-v /my/own/datadir:/var/lib/mysql` part of the command mounts the `/my/own/datadir` directory from the underlying host system as `/var/lib/mysql` inside the container, where MySQL by default will write its data files. + +Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to the new data directory so that the container will be allowed to access it: + + chcon -Rt svirt_sandbox_file_t /my/own/datadir + +## No connections until MySQL init completes + If there is no database initialized when the container starts, then a default database will be created. While this is the expected behavior, this means that it will not accept incoming connections until such initialization completes. This may cause issues when using automation tools, such as `docker-compose`, which start several containers simultaneously. + +## Usage against an existing database + +If you start your `%%REPO` container instance with a data directory that already contains a database (specifically, a `mysql` subdirectory), the `$MYSQL_ROOT_PASSWORD` variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way. From c408469abbac35ad1e4a50a6618836420eb9502e Mon Sep 17 00:00:00 2001 From: Yngve Svendsen Date: Sat, 21 Mar 2015 07:46:58 -0400 Subject: [PATCH 02/12] Update to the current general-use MySQL logo. --- mysql/logo.png | Bin 14317 -> 5062 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/mysql/logo.png b/mysql/logo.png index 2013be9f4e71c83b5fe90a8851511d30e7fe6e1a..ca32ea067e7383a6ff8898cab9e54c81201012b6 100644 GIT binary patch literal 5062 zcmV;%6FKaOP)m6n z^7Z}W!~D&X`@3rV(V6&?5&re+`I;hHg`a|=w)?_*{N1#wz|J~tjb)9dvBlE(jRocG z@J@V~_=y0Ou))&a<^KNu_4xTjbdp$vp7@p+`K3Di*s1>U;l>fquE5IJ;K0$^`nY6N zfSk3-)c)$xbeOK(l=S!b_Jsic`SJOyMc(G@^7Z&qewzH& zrHQDzz0KH6dzktA{P>j?UWlQ&%h%N4=J%Ev`~3X)kPP^j8~6G8S%jbd@ZOrW#n$2I zSAw2kiK6_~qT1x@cbc&M?A2C+o%*+7=1*W~srM=5EX^K#NnyA0bdYrNT z^5jc;mTZ!#VTz>u{QUNh2>GHkN_m#}n(t2B-cWp+ zi>bSpvcuo#?BMC{RDzs%o3T)RnUJl&#M9mU%8h)UviYPo_lyCKtiJe|9{m0OPM z`0nfQ@;z^kZj`HIjHUek{+P1FK5&rvs6JGHn^l3G_?8xap0xh-=2C&2XppC#xW~!X z;7WLv&fMZKW{3EU0{D{>u|)7nrld{MV@UeE^`i$N&BN|NQq&dzjAJ<9nU6 zF=mLr(AxXUjA)OjXO5?%yvm=r$WVTnU5BCgm>pb(p!k>^T!*1thN1h+j{f`k_>&X( zohV&~pl6S#RDYcMr$9h)kni*MUWcOJ=k1KDyIhB${LGNy>F)QF6!(-8fS|S5;pkn4 zp~u$W{`m06*x>rCNu#^U`I#K}l@(Wmp6u}S{pQD0f1Bg$?@M}@NqLsg+~v^St4O}l9q+G7Tek1$vc>UX>}PtpL_nm@%&~c-<zg8!wQV;y<8glAkw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Mj%7ElfbaLX40C^KCLPQ|z16cb zYq)RPA4!>bi1WCIVZQZhed$W;psw>T0P26%D_%7N_#|!~u0XNfNfs~VIuZ(57j}&; z7{N<4_FzmH;m)zKK{A)a%ablvaf2u)mqfJ3^HmEtCO?UVnt|%YuzW8_ErBV&gXUAg zjB<@##mL=@p8~(rg_$EiY5Fo7pAQjWT>}3GCtm%?$BJUT7^4E#V7(+HgB^I{`cRzg z^{Q6jxi>VuV%1`HBD;zJ%6W}JXdk~ou&&M zr5@k7&<;Kj6kVyNO_F{?U62f-!ZnX6qsxSlA}o<}K9!r+?M5Dhui8WR3V^LxN93Ae;Wb^xG?3qO?34funhD`@b4k(JwQj4tFX|v bP5*xYmDgn5c{!8O00000NkvXXu0mjf<78 Date: Sat, 21 Mar 2015 07:57:07 -0400 Subject: [PATCH 03/12] Update --- mysql/README.md | 114 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 89 insertions(+), 25 deletions(-) diff --git a/mysql/README.md b/mysql/README.md index 4cfdd2570..7579036d3 100644 --- a/mysql/README.md +++ b/mysql/README.md @@ -2,60 +2,124 @@ - [`5.5.42`, `5.5` (*5.5/Dockerfile*)](https://github.com/docker-library/mysql/blob/8ed790ab199eeef0f36ef0547ae28e5654cbef0d/5.5/Dockerfile) - [`5.6.23`, `5.6`, `5`, `latest` (*5.6/Dockerfile*)](https://github.com/docker-library/mysql/blob/8ed790ab199eeef0f36ef0547ae28e5654cbef0d/5.6/Dockerfile) -- [`5.7.5-m15`, `5.7.5`, `5.7` (*5.7/Dockerfile*)](https://github.com/docker-library/mysql/blob/66f8feb4296894143ced202dd0042bc361096747/5.7/Dockerfile) +- [`5.7.6-m16`, `5.7.6`, `5.7` (*5.7/Dockerfile*)](https://github.com/docker-library/mysql/blob/e0d58135e8c54a918037cfe9ea3077a3a088e0de/5.7/Dockerfile) For more information about this image and its history, please see the [relevant manifest file (`library/mysql`)](https://github.com/docker-library/official-images/blob/master/library/mysql) in the [`docker-library/official-images` GitHub repo](https://github.com/docker-library/official-images). +![logo](https://raw.githubusercontent.com/docker-library/docs/master/mysql/logo.png) + # What is MySQL? -MySQL is (as of March 2014) the world's second most widely used open-source relational database management system (RDBMS). It is named after co-founder Michael Widenius's daughter, My. The SQL phrase stands for Structured Query Language. +MySQL is the world's most popular open source database. With its proven performance, reliability and ease-of-use, MySQL has become the leading database choice for web-based applications, covering the entire range from personal projects and websites, via e-commerce and information services, all the way to high profile web properties including Facebook, Twitter, YouTube, Yahoo! and many more. -MySQL is a popular choice of database for use in web applications, and is a central component of the widely used LAMP open source web application software stack (and other 'AMP' stacks). LAMP is an acronym for "Linux, Apache, MySQL, Perl/PHP/Python." Free-software-open source projects that require a full-featured database management system often use MySQL. - -Oracle Corporation and/or affiliates own the copyright and trademark for MySQL. - -> [wikipedia.org/wiki/MySQL](https://en.wikipedia.org/wiki/MySQL) - -![logo](https://raw.githubusercontent.com/docker-library/docs/master/mysql/logo.png) +For more information and related downloads for MySQL Server and other MySQL products, please visit [www.mysql.com](http://www.mysql.com). # How to use this image -## start a `mysql` server instance +## Start a `mysql` server instance - docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=mysecretpassword -d mysql +Starting a MySQL instance is simple: -This image includes `EXPOSE 3306` (the standard MySQL port), so container linking will make it automatically available to the linked containers (as the following examples illustrate). + docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag -## connect to it from an application +... where `some-mysql` is the name you want to assign to your container, `my-secret-pw` is the password to be set for the MySQL root user and `tag` is the tag specifying the MySQL version you want. See the list above for relevant tags. - docker run --name some-app --link some-mysql:mysql -d application-that-uses-mysql +## Connect to MySQL from an application in another Docker container -## ... or via `mysql` +This image exposes the standard MySQL port (3306), so container linking makes the MySQL instance available to other application containers. Start your application container like this in order to link it to the MySQL container: + + docker run --name some-app --link some-mysql:mysql -d app-that-uses-mysql + +## Connect to MySQL from the MySQL command line client + +The following command starts another MySQL container instance and runs the `mysql` command line client against your original MySQL container, allowing you to execute SQL statements against your database instance: docker run -it --link some-mysql:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' + +... where `some-mysql` is the name of your original MySQL Server container. + +More information about the MySQL command line client can be found in the [MySQL documentation](http://dev.mysql.com/doc/en/mysql.html) + +## Container shell access and viewing MySQL logs + +The `docker exec` command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your `mysql` container: + + docker exec -it some-mysql bash + +The MySQL Server log is located at `/var/log/mysql/error.log` inside the container, and the following command line from a shell inside the container will let you inspect it: + + more /var/log/mysql/error.log + +## Using a custom MySQL configuration file + +The MySQL startup configuration is specified in the file `/etc/mysql/my.cnf`. If you want to customize this configuration for your own purposes, you can create your alternative configuration file in a directory on the host machine and then mount this file in the appropriate location inside the `mysql` container, effectively replacing the standard configuration file. + +If you want to base your changes on the standard configuration file, start your `%%REPO` container in the standard way described above, then do: + + docker exec -it some-mysql cat /etc/mysql/my.cnf > /my/custom/config-file + +... where `/my/custom/config-file` is the path and name of the new configuration file. Then start a new `mysql` container like this: + + docker run --name new-conf-mysql -v /my/custom/config-file:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag + +This will start a new container `new-conf-mysql` where the MySQL instance uses the startup options specified in `/my/custom/config-file`. + +Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to your new config file so that the container will be allowed to mount it: + + chcon -Rt svirt_sandbox_file_t /my/custom/config-file ## Environment Variables -The `mysql` image uses several environment variables which are easy to miss. While not all the variables are required, they may significantly aid you in using the image. +When you start the `mysql` image, you can adjust the configuration of the MySQL instance by passing one or more environment variables on the `docker run` command line. Do note that none of the variables below will have any effect if you start the container with a data directory that already contains a database: any pre-existing database will always be left untouched on container startup. -### `MYSQL_ROOT_PASSWORD` +## `MYSQL_ROOT_PASSWORD` -This is the one environment variable that is required. This environment variable should be what you want to set the password for the `root` user to be. In the above example, it is being set to "`mysecretpassword`". - -### `MYSQL_USER`, `MYSQL_PASSWORD` - -These optional environment variables are used in conjunction to both create a new user and set that user's password, which will subsequently be granted all permissions for the database specified by the optional `MYSQL_DATABASE` variable. Note that if you only have one of these two environment variables, then neither will do anything -- these two are required to be used in conjunction with one another. - -Additionally, there is no need to specify `MYSQL_USER` with `root`, as the `root` user already exists by default, and the password of that user is controlled by `MYSQL_ROOT_PASSWORD` (see above). +This variable is mandatory and specifies the password that will be set for the MySQL `root` superuser account. In the above example, it was set to `my-secret-pw`. ### `MYSQL_DATABASE` -This optional environment variable denotes the name of a database to create. If a user/password was supplied (via the `MYSQL_USER` and `MYSQL_PASSWORD` environment variables) then that user will be granted (via `GRANT ALL`) access to this database. +This variable is optional and allows you to specify the name of a database to be created on image startup. If a user/password was supplied (see below) then that user will be granted superuser access ([corresponding to `GRANT ALL`](http://dev.mysql.com/doc/en/adding-users.html)) to this database. + +### `MYSQL_USER`, `MYSQL_PASSWORD` + +These variables are optional, used in conjunction to create a new user and to set that user's password. This user will be granted superuser permissions (see above) for the database specified by the `MYSQL_DATABASE` variable. Both variables are required for a user to be created. + +Do note that there is no need to use this mechanism to create the root superuser, that user gets created by default with the password specified by the `MYSQL_ROOT_PASSWORD` variable. + +### `MYSQL_ALLOW_EMPTY_PASSWORD` + +Set to `yes` to allow the container to be started with a blank password for the root user. *NOTE*: Setting this variable to `yes` is not recommended unless you really know what you are doing, since this will leave your MySQL instance completely unprotected, allowing anyone to gain complete superuser access. # Caveats +## Where to Store Data + +Important note: There are several ways to store data used by applications that run in Docker containers. We encourage users of the `mysql` images to familiarize themselves with the options available, including: + +- Let Docker manage the storage of your database data [by writing the database files to disk on the host system using its own internal volume management](https://docs.docker.com/userguide/dockervolumes/#adding-a-data-volume). This is the default and is easy and fairly transparent to the user. The downside is that the files may be hard to locate for tools and applications that run directly on the host system, i.e. outside containers. +- Create a data directory on the host system (outside the container) and [mount this to a directory visible from inside the container](https://docs.docker.com/userguide/dockervolumes/#mount-a-host-directory-as-a-data-volume). This places the database files in a known location on the host system, and makes it easy for tools and applications on the host system to access the files. The downside is that the user needs to make sure that the directory exists, and that e.g. directory permissions and other security mechanisms on the host system are set up correctly. + +The Docker documentation is a good starting point for understanding the different storage options and variations, and there are multiple blogs and forum postings that discuss and give advice in this area. We will simply show the basic procedure here for the latter option above: + +1. Create a data directory on a suitable volume on your host system, e.g. `/my/own/datadir`. +2. Start your `mysql` container like this: + + docker run --name some-mysql -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag + +The `-v /my/own/datadir:/var/lib/mysql` part of the command mounts the `/my/own/datadir` directory from the underlying host system as `/var/lib/mysql` inside the container, where MySQL by default will write its data files. + +Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to the new data directory so that the container will be allowed to access it: + + chcon -Rt svirt_sandbox_file_t /my/own/datadir + +## No connections until MySQL init completes + If there is no database initialized when the container starts, then a default database will be created. While this is the expected behavior, this means that it will not accept incoming connections until such initialization completes. This may cause issues when using automation tools, such as `docker-compose`, which start several containers simultaneously. +## Usage against an existing database + +If you start your `%%REPO` container instance with a data directory that already contains a database (specifically, a `mysql` subdirectory), the `$MYSQL_ROOT_PASSWORD` variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way. + # Supported Docker versions This image is officially supported on Docker version 1.5.0. From 7545a999f46edf7e4581313361cccb1ef26e18f4 Mon Sep 17 00:00:00 2001 From: Yngve Svendsen Date: Sat, 21 Mar 2015 08:24:48 -0400 Subject: [PATCH 04/12] Regenerate --- mysql/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql/README.md b/mysql/README.md index 7579036d3..8d3249c4f 100644 --- a/mysql/README.md +++ b/mysql/README.md @@ -46,10 +46,10 @@ The `docker exec` command allows you to run commands inside a Docker container. docker exec -it some-mysql bash -The MySQL Server log is located at `/var/log/mysql/error.log` inside the container, and the following command line from a shell inside the container will let you inspect it: +The MySQL Server log is available through Docker's container log: + + docker logs some-mysql - more /var/log/mysql/error.log - ## Using a custom MySQL configuration file The MySQL startup configuration is specified in the file `/etc/mysql/my.cnf`. If you want to customize this configuration for your own purposes, you can create your alternative configuration file in a directory on the host machine and then mount this file in the appropriate location inside the `mysql` container, effectively replacing the standard configuration file. From 42013fa438a3fd005d4180d2de83a36700d3cb49 Mon Sep 17 00:00:00 2001 From: Yngve Svendsen Date: Sat, 21 Mar 2015 08:26:58 -0400 Subject: [PATCH 05/12] Update on how to view logs: MySQL logs go to stderr. --- mysql/content.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql/content.md b/mysql/content.md index 16abf3660..81f41a929 100644 --- a/mysql/content.md +++ b/mysql/content.md @@ -38,10 +38,10 @@ The `docker exec` command allows you to run commands inside a Docker container. docker exec -it some-%%REPO%% bash -The MySQL Server log is located at `/var/log/mysql/error.log` inside the container, and the following command line from a shell inside the container will let you inspect it: +The MySQL Server log is available through Docker's container log: + + docker logs some-%%REPO%% - more /var/log/mysql/error.log - ## Using a custom MySQL configuration file The MySQL startup configuration is specified in the file `/etc/mysql/my.cnf`. If you want to customize this configuration for your own purposes, you can create your alternative configuration file in a directory on the host machine and then mount this file in the appropriate location inside the `%%REPO%%` container, effectively replacing the standard configuration file. From afb409d7d0993b9bfdb725e8eae91d6d727e151f Mon Sep 17 00:00:00 2001 From: Yngve Svendsen Date: Sat, 21 Mar 2015 08:37:48 -0400 Subject: [PATCH 06/12] Tweak description of MYSQL_ALLOW_EMPTY_PASSWORD --- mysql/README.md | 2 +- mysql/content.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql/README.md b/mysql/README.md index 8d3249c4f..462166c9a 100644 --- a/mysql/README.md +++ b/mysql/README.md @@ -88,7 +88,7 @@ Do note that there is no need to use this mechanism to create the root superuser ### `MYSQL_ALLOW_EMPTY_PASSWORD` -Set to `yes` to allow the container to be started with a blank password for the root user. *NOTE*: Setting this variable to `yes` is not recommended unless you really know what you are doing, since this will leave your MySQL instance completely unprotected, allowing anyone to gain complete superuser access. +This is an optional variable. Set to `yes` to allow the container to be started with a blank password for the root user. *NOTE*: Setting this variable to `yes` is not recommended unless you really know what you are doing, since this will leave your MySQL instance completely unprotected, allowing anyone to gain complete superuser access. # Caveats diff --git a/mysql/content.md b/mysql/content.md index 81f41a929..791c3d3c6 100644 --- a/mysql/content.md +++ b/mysql/content.md @@ -80,7 +80,7 @@ Do note that there is no need to use this mechanism to create the root superuser ### `MYSQL_ALLOW_EMPTY_PASSWORD` -Set to `yes` to allow the container to be started with a blank password for the root user. *NOTE*: Setting this variable to `yes` is not recommended unless you really know what you are doing, since this will leave your MySQL instance completely unprotected, allowing anyone to gain complete superuser access. +This is an optional variable. Set to `yes` to allow the container to be started with a blank password for the root user. *NOTE*: Setting this variable to `yes` is not recommended unless you really know what you are doing, since this will leave your MySQL instance completely unprotected, allowing anyone to gain complete superuser access. # Caveats From 9e9246e9c640587f9ffb7cc023cfca401a4c3f16 Mon Sep 17 00:00:00 2001 From: Yngve Svendsen Date: Sat, 21 Mar 2015 08:44:47 -0400 Subject: [PATCH 07/12] Fix code formatting inside numbered list --- mysql/README.md | 2 +- mysql/content.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql/README.md b/mysql/README.md index 462166c9a..2bb1ae119 100644 --- a/mysql/README.md +++ b/mysql/README.md @@ -104,7 +104,7 @@ The Docker documentation is a good starting point for understanding the differen 1. Create a data directory on a suitable volume on your host system, e.g. `/my/own/datadir`. 2. Start your `mysql` container like this: - docker run --name some-mysql -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag + docker run --name some-mysql -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag The `-v /my/own/datadir:/var/lib/mysql` part of the command mounts the `/my/own/datadir` directory from the underlying host system as `/var/lib/mysql` inside the container, where MySQL by default will write its data files. diff --git a/mysql/content.md b/mysql/content.md index 791c3d3c6..2bbca4b0a 100644 --- a/mysql/content.md +++ b/mysql/content.md @@ -96,7 +96,7 @@ The Docker documentation is a good starting point for understanding the differen 1. Create a data directory on a suitable volume on your host system, e.g. `/my/own/datadir`. 2. Start your `%%REPO%%` container like this: - docker run --name some-%%REPO%% -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag + docker run --name some-%%REPO%% -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag The `-v /my/own/datadir:/var/lib/mysql` part of the command mounts the `/my/own/datadir` directory from the underlying host system as `/var/lib/mysql` inside the container, where MySQL by default will write its data files. From 385da75d9dbf5ce95161b7be35fc92753bedfdd5 Mon Sep 17 00:00:00 2001 From: Yngve Svendsen Date: Sat, 21 Mar 2015 08:50:54 -0400 Subject: [PATCH 08/12] Add missing end %% to a REPO reference --- mysql/README.md | 2 +- mysql/content.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql/README.md b/mysql/README.md index 2bb1ae119..484d7227a 100644 --- a/mysql/README.md +++ b/mysql/README.md @@ -118,7 +118,7 @@ If there is no database initialized when the container starts, then a default da ## Usage against an existing database -If you start your `%%REPO` container instance with a data directory that already contains a database (specifically, a `mysql` subdirectory), the `$MYSQL_ROOT_PASSWORD` variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way. +If you start your `mysql` container instance with a data directory that already contains a database (specifically, a `mysql` subdirectory), the `$MYSQL_ROOT_PASSWORD` variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way. # Supported Docker versions diff --git a/mysql/content.md b/mysql/content.md index 2bbca4b0a..51af70da5 100644 --- a/mysql/content.md +++ b/mysql/content.md @@ -110,4 +110,4 @@ If there is no database initialized when the container starts, then a default da ## Usage against an existing database -If you start your `%%REPO` container instance with a data directory that already contains a database (specifically, a `mysql` subdirectory), the `$MYSQL_ROOT_PASSWORD` variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way. +If you start your `%%REPO%%` container instance with a data directory that already contains a database (specifically, a `mysql` subdirectory), the `$MYSQL_ROOT_PASSWORD` variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way. From a9c0d52f6fe6e606fce50c06744942162199dcec Mon Sep 17 00:00:00 2001 From: Yngve Svendsen Date: Sun, 22 Mar 2015 09:23:09 -0400 Subject: [PATCH 09/12] Fix formatting as required by markdownfmt --- mysql/README.md | 105 ++++++++++++++++++++++++++++++++--------------- mysql/content.md | 82 +++++++++++++++++++++++++----------- 2 files changed, 128 insertions(+), 59 deletions(-) diff --git a/mysql/README.md b/mysql/README.md index 484d7227a..7d5ee6208 100644 --- a/mysql/README.md +++ b/mysql/README.md @@ -1,78 +1,103 @@ -# Supported tags and respective `Dockerfile` links +Supported tags and respective `Dockerfile` links +================================================ -- [`5.5.42`, `5.5` (*5.5/Dockerfile*)](https://github.com/docker-library/mysql/blob/8ed790ab199eeef0f36ef0547ae28e5654cbef0d/5.5/Dockerfile) -- [`5.6.23`, `5.6`, `5`, `latest` (*5.6/Dockerfile*)](https://github.com/docker-library/mysql/blob/8ed790ab199eeef0f36ef0547ae28e5654cbef0d/5.6/Dockerfile) -- [`5.7.6-m16`, `5.7.6`, `5.7` (*5.7/Dockerfile*)](https://github.com/docker-library/mysql/blob/e0d58135e8c54a918037cfe9ea3077a3a088e0de/5.7/Dockerfile) +- [`5.5.42`, `5.5` (*5.5/Dockerfile*\)](https://github.com/docker-library/mysql/blob/8ed790ab199eeef0f36ef0547ae28e5654cbef0d/5.5/Dockerfile) +- [`5.6.23`, `5.6`, `5`, `latest` (*5.6/Dockerfile*\)](https://github.com/docker-library/mysql/blob/8ed790ab199eeef0f36ef0547ae28e5654cbef0d/5.6/Dockerfile) +- [`5.7.6-m16`, `5.7.6`, `5.7` (*5.7/Dockerfile*\)](https://github.com/docker-library/mysql/blob/e0d58135e8c54a918037cfe9ea3077a3a088e0de/5.7/Dockerfile) -For more information about this image and its history, please see the [relevant manifest file (`library/mysql`)](https://github.com/docker-library/official-images/blob/master/library/mysql) in the [`docker-library/official-images` GitHub repo](https://github.com/docker-library/official-images). +For more information about this image and its history, please see the [relevant manifest file (`library/mysql`\)](https://github.com/docker-library/official-images/blob/master/library/mysql) in the [`docker-library/official-images` GitHub repo](https://github.com/docker-library/official-images). ![logo](https://raw.githubusercontent.com/docker-library/docs/master/mysql/logo.png) -# What is MySQL? +What is MySQL? +============== MySQL is the world's most popular open source database. With its proven performance, reliability and ease-of-use, MySQL has become the leading database choice for web-based applications, covering the entire range from personal projects and websites, via e-commerce and information services, all the way to high profile web properties including Facebook, Twitter, YouTube, Yahoo! and many more. For more information and related downloads for MySQL Server and other MySQL products, please visit [www.mysql.com](http://www.mysql.com). -# How to use this image +How to use this image +===================== -## Start a `mysql` server instance +Start a `mysql` server instance +------------------------------- Starting a MySQL instance is simple: - docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag +``` +docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag +``` ... where `some-mysql` is the name you want to assign to your container, `my-secret-pw` is the password to be set for the MySQL root user and `tag` is the tag specifying the MySQL version you want. See the list above for relevant tags. -## Connect to MySQL from an application in another Docker container +Connect to MySQL from an application in another Docker container +---------------------------------------------------------------- This image exposes the standard MySQL port (3306), so container linking makes the MySQL instance available to other application containers. Start your application container like this in order to link it to the MySQL container: - docker run --name some-app --link some-mysql:mysql -d app-that-uses-mysql +``` +docker run --name some-app --link some-mysql:mysql -d app-that-uses-mysql +``` -## Connect to MySQL from the MySQL command line client +Connect to MySQL from the MySQL command line client +--------------------------------------------------- The following command starts another MySQL container instance and runs the `mysql` command line client against your original MySQL container, allowing you to execute SQL statements against your database instance: - docker run -it --link some-mysql:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' - +``` +docker run -it --link some-mysql:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' +``` + ... where `some-mysql` is the name of your original MySQL Server container. More information about the MySQL command line client can be found in the [MySQL documentation](http://dev.mysql.com/doc/en/mysql.html) -## Container shell access and viewing MySQL logs +Container shell access and viewing MySQL logs +--------------------------------------------- The `docker exec` command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your `mysql` container: - docker exec -it some-mysql bash +``` +docker exec -it some-mysql bash +``` The MySQL Server log is available through Docker's container log: - docker logs some-mysql +``` +docker logs some-mysql +``` -## Using a custom MySQL configuration file +Using a custom MySQL configuration file +--------------------------------------- The MySQL startup configuration is specified in the file `/etc/mysql/my.cnf`. If you want to customize this configuration for your own purposes, you can create your alternative configuration file in a directory on the host machine and then mount this file in the appropriate location inside the `mysql` container, effectively replacing the standard configuration file. If you want to base your changes on the standard configuration file, start your `%%REPO` container in the standard way described above, then do: - docker exec -it some-mysql cat /etc/mysql/my.cnf > /my/custom/config-file +``` +docker exec -it some-mysql cat /etc/mysql/my.cnf > /my/custom/config-file +``` ... where `/my/custom/config-file` is the path and name of the new configuration file. Then start a new `mysql` container like this: - docker run --name new-conf-mysql -v /my/custom/config-file:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag +``` +docker run --name new-conf-mysql -v /my/custom/config-file:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag +``` This will start a new container `new-conf-mysql` where the MySQL instance uses the startup options specified in `/my/custom/config-file`. Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to your new config file so that the container will be allowed to mount it: - chcon -Rt svirt_sandbox_file_t /my/custom/config-file +``` +chcon -Rt svirt_sandbox_file_t /my/custom/config-file +``` -## Environment Variables +Environment Variables +--------------------- When you start the `mysql` image, you can adjust the configuration of the MySQL instance by passing one or more environment variables on the `docker run` command line. Do note that none of the variables below will have any effect if you start the container with a data directory that already contains a database: any pre-existing database will always be left untouched on container startup. -## `MYSQL_ROOT_PASSWORD` +### `MYSQL_ROOT_PASSWORD` This variable is mandatory and specifies the password that will be set for the MySQL `root` superuser account. In the above example, it was set to `my-secret-pw`. @@ -90,9 +115,11 @@ Do note that there is no need to use this mechanism to create the root superuser This is an optional variable. Set to `yes` to allow the container to be started with a blank password for the root user. *NOTE*: Setting this variable to `yes` is not recommended unless you really know what you are doing, since this will leave your MySQL instance completely unprotected, allowing anyone to gain complete superuser access. -# Caveats +Caveats +======= -## Where to Store Data +Where to Store Data +------------------- Important note: There are several ways to store data used by applications that run in Docker containers. We encourage users of the `mysql` images to familiarize themselves with the options available, including: @@ -102,39 +129,49 @@ Important note: There are several ways to store data used by applications that r The Docker documentation is a good starting point for understanding the different storage options and variations, and there are multiple blogs and forum postings that discuss and give advice in this area. We will simply show the basic procedure here for the latter option above: 1. Create a data directory on a suitable volume on your host system, e.g. `/my/own/datadir`. -2. Start your `mysql` container like this: +2. Start your `mysql` container like this: - docker run --name some-mysql -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag + ``` + docker run --name some-mysql -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag + ``` The `-v /my/own/datadir:/var/lib/mysql` part of the command mounts the `/my/own/datadir` directory from the underlying host system as `/var/lib/mysql` inside the container, where MySQL by default will write its data files. Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to the new data directory so that the container will be allowed to access it: - chcon -Rt svirt_sandbox_file_t /my/own/datadir +``` +chcon -Rt svirt_sandbox_file_t /my/own/datadir +``` -## No connections until MySQL init completes +No connections until MySQL init completes +----------------------------------------- If there is no database initialized when the container starts, then a default database will be created. While this is the expected behavior, this means that it will not accept incoming connections until such initialization completes. This may cause issues when using automation tools, such as `docker-compose`, which start several containers simultaneously. -## Usage against an existing database +Usage against an existing database +---------------------------------- If you start your `mysql` container instance with a data directory that already contains a database (specifically, a `mysql` subdirectory), the `$MYSQL_ROOT_PASSWORD` variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way. -# Supported Docker versions +Supported Docker versions +========================= This image is officially supported on Docker version 1.5.0. Support for older versions (down to 1.0) is provided on a best-effort basis. -# User Feedback +User Feedback +============= -## Issues +Issues +------ If you have any problems with or questions about this image, please contact us through a [GitHub issue](https://github.com/docker-library/mysql/issues). You can also reach many of the official image maintainers via the `#docker-library` IRC channel on [Freenode](https://freenode.net). -## Contributing +Contributing +------------ You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can. diff --git a/mysql/content.md b/mysql/content.md index 51af70da5..484e6a724 100644 --- a/mysql/content.md +++ b/mysql/content.md @@ -1,70 +1,94 @@ %%LOGO%% -# What is MySQL? +What is MySQL? +============== MySQL is the world's most popular open source database. With its proven performance, reliability and ease-of-use, MySQL has become the leading database choice for web-based applications, covering the entire range from personal projects and websites, via e-commerce and information services, all the way to high profile web properties including Facebook, Twitter, YouTube, Yahoo! and many more. For more information and related downloads for MySQL Server and other MySQL products, please visit [www.mysql.com](http://www.mysql.com). -# How to use this image +How to use this image +===================== -## Start a `%%REPO%%` server instance +Start a `%%REPO%%` server instance +---------------------------------- Starting a MySQL instance is simple: - docker run --name some-%%REPO%% -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag +``` +docker run --name some-%%REPO%% -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag +``` ... where `some-%%REPO%%` is the name you want to assign to your container, `my-secret-pw` is the password to be set for the MySQL root user and `tag` is the tag specifying the MySQL version you want. See the list above for relevant tags. -## Connect to MySQL from an application in another Docker container +Connect to MySQL from an application in another Docker container +---------------------------------------------------------------- This image exposes the standard MySQL port (3306), so container linking makes the MySQL instance available to other application containers. Start your application container like this in order to link it to the MySQL container: - docker run --name some-app --link some-%%REPO%%:mysql -d app-that-uses-mysql +``` +docker run --name some-app --link some-%%REPO%%:mysql -d app-that-uses-mysql +``` -## Connect to MySQL from the MySQL command line client +Connect to MySQL from the MySQL command line client +--------------------------------------------------- The following command starts another MySQL container instance and runs the `mysql` command line client against your original MySQL container, allowing you to execute SQL statements against your database instance: - docker run -it --link some-%%REPO%%:mysql --rm %%REPO%% sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' - +``` +docker run -it --link some-%%REPO%%:mysql --rm %%REPO%% sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' +``` + ... where `some-%%REPO%%` is the name of your original MySQL Server container. More information about the MySQL command line client can be found in the [MySQL documentation](http://dev.mysql.com/doc/en/mysql.html) -## Container shell access and viewing MySQL logs +Container shell access and viewing MySQL logs +--------------------------------------------- The `docker exec` command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your `%%REPO%%` container: - docker exec -it some-%%REPO%% bash +``` +docker exec -it some-%%REPO%% bash +``` The MySQL Server log is available through Docker's container log: - docker logs some-%%REPO%% +``` +docker logs some-%%REPO%% +``` -## Using a custom MySQL configuration file +Using a custom MySQL configuration file +--------------------------------------- The MySQL startup configuration is specified in the file `/etc/mysql/my.cnf`. If you want to customize this configuration for your own purposes, you can create your alternative configuration file in a directory on the host machine and then mount this file in the appropriate location inside the `%%REPO%%` container, effectively replacing the standard configuration file. If you want to base your changes on the standard configuration file, start your `%%REPO` container in the standard way described above, then do: - docker exec -it some-%%REPO%% cat /etc/mysql/my.cnf > /my/custom/config-file +``` +docker exec -it some-%%REPO%% cat /etc/mysql/my.cnf > /my/custom/config-file +``` ... where `/my/custom/config-file` is the path and name of the new configuration file. Then start a new `%%REPO%%` container like this: - docker run --name new-conf-%%REPO%% -v /my/custom/config-file:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag +``` +docker run --name new-conf-%%REPO%% -v /my/custom/config-file:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag +``` This will start a new container `new-conf-%%REPO%%` where the MySQL instance uses the startup options specified in `/my/custom/config-file`. Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to your new config file so that the container will be allowed to mount it: - chcon -Rt svirt_sandbox_file_t /my/custom/config-file +``` +chcon -Rt svirt_sandbox_file_t /my/custom/config-file +``` -## Environment Variables +Environment Variables +--------------------- When you start the `%%REPO%%` image, you can adjust the configuration of the MySQL instance by passing one or more environment variables on the `docker run` command line. Do note that none of the variables below will have any effect if you start the container with a data directory that already contains a database: any pre-existing database will always be left untouched on container startup. -## `MYSQL_ROOT_PASSWORD` +### `MYSQL_ROOT_PASSWORD` This variable is mandatory and specifies the password that will be set for the MySQL `root` superuser account. In the above example, it was set to `my-secret-pw`. @@ -82,9 +106,11 @@ Do note that there is no need to use this mechanism to create the root superuser This is an optional variable. Set to `yes` to allow the container to be started with a blank password for the root user. *NOTE*: Setting this variable to `yes` is not recommended unless you really know what you are doing, since this will leave your MySQL instance completely unprotected, allowing anyone to gain complete superuser access. -# Caveats +Caveats +======= -## Where to Store Data +Where to Store Data +------------------- Important note: There are several ways to store data used by applications that run in Docker containers. We encourage users of the `%%REPO%%` images to familiarize themselves with the options available, including: @@ -94,20 +120,26 @@ Important note: There are several ways to store data used by applications that r The Docker documentation is a good starting point for understanding the different storage options and variations, and there are multiple blogs and forum postings that discuss and give advice in this area. We will simply show the basic procedure here for the latter option above: 1. Create a data directory on a suitable volume on your host system, e.g. `/my/own/datadir`. -2. Start your `%%REPO%%` container like this: +2. Start your `%%REPO%%` container like this: - docker run --name some-%%REPO%% -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag + ``` + docker run --name some-%%REPO%% -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag + ``` The `-v /my/own/datadir:/var/lib/mysql` part of the command mounts the `/my/own/datadir` directory from the underlying host system as `/var/lib/mysql` inside the container, where MySQL by default will write its data files. Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to the new data directory so that the container will be allowed to access it: - chcon -Rt svirt_sandbox_file_t /my/own/datadir +``` +chcon -Rt svirt_sandbox_file_t /my/own/datadir +``` -## No connections until MySQL init completes +No connections until MySQL init completes +----------------------------------------- If there is no database initialized when the container starts, then a default database will be created. While this is the expected behavior, this means that it will not accept incoming connections until such initialization completes. This may cause issues when using automation tools, such as `docker-compose`, which start several containers simultaneously. -## Usage against an existing database +Usage against an existing database +---------------------------------- If you start your `%%REPO%%` container instance with a data directory that already contains a database (specifically, a `mysql` subdirectory), the `$MYSQL_ROOT_PASSWORD` variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way. From ada33d0600727d66e20f0ce750684126a74a6f1a Mon Sep 17 00:00:00 2001 From: Yngve Svendsen Date: Tue, 24 Mar 2015 04:56:28 -0400 Subject: [PATCH 10/12] Adjust to pass markdownfmt --- mysql/README.md | 79 +++++++++++++----------------------------------- mysql/content.md | 56 ++++++++-------------------------- 2 files changed, 33 insertions(+), 102 deletions(-) diff --git a/mysql/README.md b/mysql/README.md index 7d5ee6208..f73640df0 100644 --- a/mysql/README.md +++ b/mysql/README.md @@ -1,99 +1,74 @@ -Supported tags and respective `Dockerfile` links -================================================ +# Supported tags and respective `Dockerfile` links -- [`5.5.42`, `5.5` (*5.5/Dockerfile*\)](https://github.com/docker-library/mysql/blob/8ed790ab199eeef0f36ef0547ae28e5654cbef0d/5.5/Dockerfile) -- [`5.6.23`, `5.6`, `5`, `latest` (*5.6/Dockerfile*\)](https://github.com/docker-library/mysql/blob/8ed790ab199eeef0f36ef0547ae28e5654cbef0d/5.6/Dockerfile) -- [`5.7.6-m16`, `5.7.6`, `5.7` (*5.7/Dockerfile*\)](https://github.com/docker-library/mysql/blob/e0d58135e8c54a918037cfe9ea3077a3a088e0de/5.7/Dockerfile) +- [`5.5.42`, `5.5` (*5.5/Dockerfile*)](https://github.com/docker-library/mysql/blob/8ed790ab199eeef0f36ef0547ae28e5654cbef0d/5.5/Dockerfile) +- [`5.6.23`, `5.6`, `5`, `latest` (*5.6/Dockerfile*)](https://github.com/docker-library/mysql/blob/8ed790ab199eeef0f36ef0547ae28e5654cbef0d/5.6/Dockerfile) +- [`5.7.6-m16`, `5.7.6`, `5.7` (*5.7/Dockerfile*)](https://github.com/docker-library/mysql/blob/e0d58135e8c54a918037cfe9ea3077a3a088e0de/5.7/Dockerfile) -For more information about this image and its history, please see the [relevant manifest file (`library/mysql`\)](https://github.com/docker-library/official-images/blob/master/library/mysql) in the [`docker-library/official-images` GitHub repo](https://github.com/docker-library/official-images). +For more information about this image and its history, please see the [relevant manifest file (`library/mysql`)](https://github.com/docker-library/official-images/blob/master/library/mysql) in the [`docker-library/official-images` GitHub repo](https://github.com/docker-library/official-images). ![logo](https://raw.githubusercontent.com/docker-library/docs/master/mysql/logo.png) -What is MySQL? -============== +# What is MySQL? MySQL is the world's most popular open source database. With its proven performance, reliability and ease-of-use, MySQL has become the leading database choice for web-based applications, covering the entire range from personal projects and websites, via e-commerce and information services, all the way to high profile web properties including Facebook, Twitter, YouTube, Yahoo! and many more. For more information and related downloads for MySQL Server and other MySQL products, please visit [www.mysql.com](http://www.mysql.com). -How to use this image -===================== +# How to use this image -Start a `mysql` server instance -------------------------------- +## Start a `mysql` server instance Starting a MySQL instance is simple: -``` docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag -``` ... where `some-mysql` is the name you want to assign to your container, `my-secret-pw` is the password to be set for the MySQL root user and `tag` is the tag specifying the MySQL version you want. See the list above for relevant tags. -Connect to MySQL from an application in another Docker container ----------------------------------------------------------------- +## Connect to MySQL from an application in another Docker container This image exposes the standard MySQL port (3306), so container linking makes the MySQL instance available to other application containers. Start your application container like this in order to link it to the MySQL container: -``` docker run --name some-app --link some-mysql:mysql -d app-that-uses-mysql -``` -Connect to MySQL from the MySQL command line client ---------------------------------------------------- +## Connect to MySQL from the MySQL command line client The following command starts another MySQL container instance and runs the `mysql` command line client against your original MySQL container, allowing you to execute SQL statements against your database instance: -``` docker run -it --link some-mysql:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' -``` ... where `some-mysql` is the name of your original MySQL Server container. More information about the MySQL command line client can be found in the [MySQL documentation](http://dev.mysql.com/doc/en/mysql.html) -Container shell access and viewing MySQL logs ---------------------------------------------- +## Container shell access and viewing MySQL logs The `docker exec` command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your `mysql` container: -``` docker exec -it some-mysql bash -``` The MySQL Server log is available through Docker's container log: -``` docker logs some-mysql -``` -Using a custom MySQL configuration file ---------------------------------------- +## Using a custom MySQL configuration file The MySQL startup configuration is specified in the file `/etc/mysql/my.cnf`. If you want to customize this configuration for your own purposes, you can create your alternative configuration file in a directory on the host machine and then mount this file in the appropriate location inside the `mysql` container, effectively replacing the standard configuration file. If you want to base your changes on the standard configuration file, start your `%%REPO` container in the standard way described above, then do: -``` docker exec -it some-mysql cat /etc/mysql/my.cnf > /my/custom/config-file -``` ... where `/my/custom/config-file` is the path and name of the new configuration file. Then start a new `mysql` container like this: -``` docker run --name new-conf-mysql -v /my/custom/config-file:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag -``` This will start a new container `new-conf-mysql` where the MySQL instance uses the startup options specified in `/my/custom/config-file`. Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to your new config file so that the container will be allowed to mount it: -``` chcon -Rt svirt_sandbox_file_t /my/custom/config-file -``` -Environment Variables ---------------------- +## Environment Variables When you start the `mysql` image, you can adjust the configuration of the MySQL instance by passing one or more environment variables on the `docker run` command line. Do note that none of the variables below will have any effect if you start the container with a data directory that already contains a database: any pre-existing database will always be left untouched on container startup. @@ -115,11 +90,9 @@ Do note that there is no need to use this mechanism to create the root superuser This is an optional variable. Set to `yes` to allow the container to be started with a blank password for the root user. *NOTE*: Setting this variable to `yes` is not recommended unless you really know what you are doing, since this will leave your MySQL instance completely unprotected, allowing anyone to gain complete superuser access. -Caveats -======= +# Caveats -Where to Store Data -------------------- +## Where to Store Data Important note: There are several ways to store data used by applications that run in Docker containers. We encourage users of the `mysql` images to familiarize themselves with the options available, including: @@ -131,47 +104,37 @@ The Docker documentation is a good starting point for understanding the differen 1. Create a data directory on a suitable volume on your host system, e.g. `/my/own/datadir`. 2. Start your `mysql` container like this: - ``` docker run --name some-mysql -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag - ``` The `-v /my/own/datadir:/var/lib/mysql` part of the command mounts the `/my/own/datadir` directory from the underlying host system as `/var/lib/mysql` inside the container, where MySQL by default will write its data files. Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to the new data directory so that the container will be allowed to access it: -``` chcon -Rt svirt_sandbox_file_t /my/own/datadir -``` -No connections until MySQL init completes ------------------------------------------ +## No connections until MySQL init completes If there is no database initialized when the container starts, then a default database will be created. While this is the expected behavior, this means that it will not accept incoming connections until such initialization completes. This may cause issues when using automation tools, such as `docker-compose`, which start several containers simultaneously. -Usage against an existing database ----------------------------------- +## Usage against an existing database If you start your `mysql` container instance with a data directory that already contains a database (specifically, a `mysql` subdirectory), the `$MYSQL_ROOT_PASSWORD` variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way. -Supported Docker versions -========================= +# Supported Docker versions This image is officially supported on Docker version 1.5.0. Support for older versions (down to 1.0) is provided on a best-effort basis. -User Feedback -============= +# User Feedback -Issues ------- +## Issues If you have any problems with or questions about this image, please contact us through a [GitHub issue](https://github.com/docker-library/mysql/issues). You can also reach many of the official image maintainers via the `#docker-library` IRC channel on [Freenode](https://freenode.net). -Contributing ------------- +## Contributing You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can. diff --git a/mysql/content.md b/mysql/content.md index 484e6a724..56e0f5a82 100644 --- a/mysql/content.md +++ b/mysql/content.md @@ -1,90 +1,66 @@ %%LOGO%% -What is MySQL? -============== +# What is MySQL? MySQL is the world's most popular open source database. With its proven performance, reliability and ease-of-use, MySQL has become the leading database choice for web-based applications, covering the entire range from personal projects and websites, via e-commerce and information services, all the way to high profile web properties including Facebook, Twitter, YouTube, Yahoo! and many more. For more information and related downloads for MySQL Server and other MySQL products, please visit [www.mysql.com](http://www.mysql.com). -How to use this image -===================== +# How to use this image -Start a `%%REPO%%` server instance ----------------------------------- +## Start a `%%REPO%%` server instance Starting a MySQL instance is simple: -``` docker run --name some-%%REPO%% -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag -``` ... where `some-%%REPO%%` is the name you want to assign to your container, `my-secret-pw` is the password to be set for the MySQL root user and `tag` is the tag specifying the MySQL version you want. See the list above for relevant tags. -Connect to MySQL from an application in another Docker container ----------------------------------------------------------------- +## Connect to MySQL from an application in another Docker container This image exposes the standard MySQL port (3306), so container linking makes the MySQL instance available to other application containers. Start your application container like this in order to link it to the MySQL container: -``` docker run --name some-app --link some-%%REPO%%:mysql -d app-that-uses-mysql -``` -Connect to MySQL from the MySQL command line client ---------------------------------------------------- +## Connect to MySQL from the MySQL command line client The following command starts another MySQL container instance and runs the `mysql` command line client against your original MySQL container, allowing you to execute SQL statements against your database instance: -``` docker run -it --link some-%%REPO%%:mysql --rm %%REPO%% sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' -``` ... where `some-%%REPO%%` is the name of your original MySQL Server container. More information about the MySQL command line client can be found in the [MySQL documentation](http://dev.mysql.com/doc/en/mysql.html) -Container shell access and viewing MySQL logs ---------------------------------------------- +## Container shell access and viewing MySQL logs The `docker exec` command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your `%%REPO%%` container: -``` docker exec -it some-%%REPO%% bash -``` The MySQL Server log is available through Docker's container log: -``` docker logs some-%%REPO%% -``` -Using a custom MySQL configuration file ---------------------------------------- +## Using a custom MySQL configuration file The MySQL startup configuration is specified in the file `/etc/mysql/my.cnf`. If you want to customize this configuration for your own purposes, you can create your alternative configuration file in a directory on the host machine and then mount this file in the appropriate location inside the `%%REPO%%` container, effectively replacing the standard configuration file. If you want to base your changes on the standard configuration file, start your `%%REPO` container in the standard way described above, then do: -``` docker exec -it some-%%REPO%% cat /etc/mysql/my.cnf > /my/custom/config-file -``` ... where `/my/custom/config-file` is the path and name of the new configuration file. Then start a new `%%REPO%%` container like this: -``` docker run --name new-conf-%%REPO%% -v /my/custom/config-file:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag -``` This will start a new container `new-conf-%%REPO%%` where the MySQL instance uses the startup options specified in `/my/custom/config-file`. Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to your new config file so that the container will be allowed to mount it: -``` chcon -Rt svirt_sandbox_file_t /my/custom/config-file -``` -Environment Variables ---------------------- +## Environment Variables When you start the `%%REPO%%` image, you can adjust the configuration of the MySQL instance by passing one or more environment variables on the `docker run` command line. Do note that none of the variables below will have any effect if you start the container with a data directory that already contains a database: any pre-existing database will always be left untouched on container startup. @@ -106,11 +82,9 @@ Do note that there is no need to use this mechanism to create the root superuser This is an optional variable. Set to `yes` to allow the container to be started with a blank password for the root user. *NOTE*: Setting this variable to `yes` is not recommended unless you really know what you are doing, since this will leave your MySQL instance completely unprotected, allowing anyone to gain complete superuser access. -Caveats -======= +# Caveats -Where to Store Data -------------------- +## Where to Store Data Important note: There are several ways to store data used by applications that run in Docker containers. We encourage users of the `%%REPO%%` images to familiarize themselves with the options available, including: @@ -122,24 +96,18 @@ The Docker documentation is a good starting point for understanding the differen 1. Create a data directory on a suitable volume on your host system, e.g. `/my/own/datadir`. 2. Start your `%%REPO%%` container like this: - ``` docker run --name some-%%REPO%% -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag - ``` The `-v /my/own/datadir:/var/lib/mysql` part of the command mounts the `/my/own/datadir` directory from the underlying host system as `/var/lib/mysql` inside the container, where MySQL by default will write its data files. Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to the new data directory so that the container will be allowed to access it: -``` chcon -Rt svirt_sandbox_file_t /my/own/datadir -``` -No connections until MySQL init completes ------------------------------------------ +## No connections until MySQL init completes If there is no database initialized when the container starts, then a default database will be created. While this is the expected behavior, this means that it will not accept incoming connections until such initialization completes. This may cause issues when using automation tools, such as `docker-compose`, which start several containers simultaneously. -Usage against an existing database ----------------------------------- +## Usage against an existing database If you start your `%%REPO%%` container instance with a data directory that already contains a database (specifically, a `mysql` subdirectory), the `$MYSQL_ROOT_PASSWORD` variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way. From 715a696abe24379411077c8d0dbec33bdd52fafc Mon Sep 17 00:00:00 2001 From: Yngve Svendsen Date: Wed, 25 Mar 2015 11:37:02 +0100 Subject: [PATCH 11/12] add back in code block indents. --- mysql/README.md | 18 +++++++++--------- mysql/content.md | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mysql/README.md b/mysql/README.md index f73640df0..7e8f91652 100644 --- a/mysql/README.md +++ b/mysql/README.md @@ -20,7 +20,7 @@ For more information and related downloads for MySQL Server and other MySQL prod Starting a MySQL instance is simple: -docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag + docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag ... where `some-mysql` is the name you want to assign to your container, `my-secret-pw` is the password to be set for the MySQL root user and `tag` is the tag specifying the MySQL version you want. See the list above for relevant tags. @@ -28,13 +28,13 @@ docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag This image exposes the standard MySQL port (3306), so container linking makes the MySQL instance available to other application containers. Start your application container like this in order to link it to the MySQL container: -docker run --name some-app --link some-mysql:mysql -d app-that-uses-mysql + docker run --name some-app --link some-mysql:mysql -d app-that-uses-mysql ## Connect to MySQL from the MySQL command line client The following command starts another MySQL container instance and runs the `mysql` command line client against your original MySQL container, allowing you to execute SQL statements against your database instance: -docker run -it --link some-mysql:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' + docker run -it --link some-mysql:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' ... where `some-mysql` is the name of your original MySQL Server container. @@ -44,11 +44,11 @@ More information about the MySQL command line client can be found in the [MySQL The `docker exec` command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your `mysql` container: -docker exec -it some-mysql bash + docker exec -it some-mysql bash The MySQL Server log is available through Docker's container log: -docker logs some-mysql + docker logs some-mysql ## Using a custom MySQL configuration file @@ -56,17 +56,17 @@ The MySQL startup configuration is specified in the file `/etc/mysql/my.cnf`. If If you want to base your changes on the standard configuration file, start your `%%REPO` container in the standard way described above, then do: -docker exec -it some-mysql cat /etc/mysql/my.cnf > /my/custom/config-file + docker exec -it some-mysql cat /etc/mysql/my.cnf > /my/custom/config-file ... where `/my/custom/config-file` is the path and name of the new configuration file. Then start a new `mysql` container like this: -docker run --name new-conf-mysql -v /my/custom/config-file:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag + docker run --name new-conf-mysql -v /my/custom/config-file:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag This will start a new container `new-conf-mysql` where the MySQL instance uses the startup options specified in `/my/custom/config-file`. Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to your new config file so that the container will be allowed to mount it: -chcon -Rt svirt_sandbox_file_t /my/custom/config-file + chcon -Rt svirt_sandbox_file_t /my/custom/config-file ## Environment Variables @@ -110,7 +110,7 @@ The `-v /my/own/datadir:/var/lib/mysql` part of the command mounts the `/my/own/ Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to the new data directory so that the container will be allowed to access it: -chcon -Rt svirt_sandbox_file_t /my/own/datadir + chcon -Rt svirt_sandbox_file_t /my/own/datadir ## No connections until MySQL init completes diff --git a/mysql/content.md b/mysql/content.md index 56e0f5a82..5d79c0cd1 100644 --- a/mysql/content.md +++ b/mysql/content.md @@ -12,7 +12,7 @@ For more information and related downloads for MySQL Server and other MySQL prod Starting a MySQL instance is simple: -docker run --name some-%%REPO%% -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag + docker run --name some-%%REPO%% -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag ... where `some-%%REPO%%` is the name you want to assign to your container, `my-secret-pw` is the password to be set for the MySQL root user and `tag` is the tag specifying the MySQL version you want. See the list above for relevant tags. @@ -20,13 +20,13 @@ docker run --name some-%%REPO%% -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%: This image exposes the standard MySQL port (3306), so container linking makes the MySQL instance available to other application containers. Start your application container like this in order to link it to the MySQL container: -docker run --name some-app --link some-%%REPO%%:mysql -d app-that-uses-mysql + docker run --name some-app --link some-%%REPO%%:mysql -d app-that-uses-mysql ## Connect to MySQL from the MySQL command line client The following command starts another MySQL container instance and runs the `mysql` command line client against your original MySQL container, allowing you to execute SQL statements against your database instance: -docker run -it --link some-%%REPO%%:mysql --rm %%REPO%% sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' + docker run -it --link some-%%REPO%%:mysql --rm %%REPO%% sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' ... where `some-%%REPO%%` is the name of your original MySQL Server container. @@ -36,11 +36,11 @@ More information about the MySQL command line client can be found in the [MySQL The `docker exec` command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your `%%REPO%%` container: -docker exec -it some-%%REPO%% bash + docker exec -it some-%%REPO%% bash The MySQL Server log is available through Docker's container log: -docker logs some-%%REPO%% + docker logs some-%%REPO%% ## Using a custom MySQL configuration file @@ -48,17 +48,17 @@ The MySQL startup configuration is specified in the file `/etc/mysql/my.cnf`. If If you want to base your changes on the standard configuration file, start your `%%REPO` container in the standard way described above, then do: -docker exec -it some-%%REPO%% cat /etc/mysql/my.cnf > /my/custom/config-file + docker exec -it some-%%REPO%% cat /etc/mysql/my.cnf > /my/custom/config-file ... where `/my/custom/config-file` is the path and name of the new configuration file. Then start a new `%%REPO%%` container like this: -docker run --name new-conf-%%REPO%% -v /my/custom/config-file:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag + docker run --name new-conf-%%REPO%% -v /my/custom/config-file:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag This will start a new container `new-conf-%%REPO%%` where the MySQL instance uses the startup options specified in `/my/custom/config-file`. Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to your new config file so that the container will be allowed to mount it: -chcon -Rt svirt_sandbox_file_t /my/custom/config-file + chcon -Rt svirt_sandbox_file_t /my/custom/config-file ## Environment Variables @@ -102,7 +102,7 @@ The `-v /my/own/datadir:/var/lib/mysql` part of the command mounts the `/my/own/ Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to the new data directory so that the container will be allowed to access it: -chcon -Rt svirt_sandbox_file_t /my/own/datadir + chcon -Rt svirt_sandbox_file_t /my/own/datadir ## No connections until MySQL init completes From 1d50dbfc88a254788da1e9911c0c244dcf66779f Mon Sep 17 00:00:00 2001 From: Yngve Svendsen Date: Wed, 25 Mar 2015 16:38:29 +0100 Subject: [PATCH 12/12] Rewrite the custom config file section --- mysql/README.md | 14 +++++--------- mysql/content.md | 14 +++++--------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/mysql/README.md b/mysql/README.md index 7e8f91652..a8b550275 100644 --- a/mysql/README.md +++ b/mysql/README.md @@ -52,21 +52,17 @@ The MySQL Server log is available through Docker's container log: ## Using a custom MySQL configuration file -The MySQL startup configuration is specified in the file `/etc/mysql/my.cnf`. If you want to customize this configuration for your own purposes, you can create your alternative configuration file in a directory on the host machine and then mount this file in the appropriate location inside the `mysql` container, effectively replacing the standard configuration file. +The MySQL startup configuration is specified in the file `/etc/mysql/my.cnf`, and that file in turn includes any files found in the `/etc/mysql/conf.d` directory. Settings in files in this directory will augment and/or override settings in `/etc/mysql/my.cnf`. If you want to use a customized MySQL configuration, you can create your alternative configuration file in a directory on the host machine and then mount that directory location as `/etc/mysql/conf.d` inside the `mysql` container. -If you want to base your changes on the standard configuration file, start your `%%REPO` container in the standard way described above, then do: +If `/my/custom/config-file` is the path and name of your custom configuration file, you can start your `mysql` container like this (note that only the directory path of the custom config file is used in this command): - docker exec -it some-mysql cat /etc/mysql/my.cnf > /my/custom/config-file + docker run --name some-mysql -v /my/custom:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag -... where `/my/custom/config-file` is the path and name of the new configuration file. Then start a new `mysql` container like this: - - docker run --name new-conf-mysql -v /my/custom/config-file:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag - -This will start a new container `new-conf-mysql` where the MySQL instance uses the startup options specified in `/my/custom/config-file`. +This will start a new container `some-mysql` where the MySQL instance uses the combined startup settings from `/etc/mysql/my.cnf` and `/etc/mysql/conf.d/config-file`, with settings from the latter taking precedence. Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to your new config file so that the container will be allowed to mount it: - chcon -Rt svirt_sandbox_file_t /my/custom/config-file + chcon -Rt svirt_sandbox_file_t /my/custom ## Environment Variables diff --git a/mysql/content.md b/mysql/content.md index 5d79c0cd1..cf7376050 100644 --- a/mysql/content.md +++ b/mysql/content.md @@ -44,21 +44,17 @@ The MySQL Server log is available through Docker's container log: ## Using a custom MySQL configuration file -The MySQL startup configuration is specified in the file `/etc/mysql/my.cnf`. If you want to customize this configuration for your own purposes, you can create your alternative configuration file in a directory on the host machine and then mount this file in the appropriate location inside the `%%REPO%%` container, effectively replacing the standard configuration file. +The MySQL startup configuration is specified in the file `/etc/mysql/my.cnf`, and that file in turn includes any files found in the `/etc/mysql/conf.d` directory. Settings in files in this directory will augment and/or override settings in `/etc/mysql/my.cnf`. If you want to use a customized MySQL configuration, you can create your alternative configuration file in a directory on the host machine and then mount that directory location as `/etc/mysql/conf.d` inside the `%%REPO%%` container. -If you want to base your changes on the standard configuration file, start your `%%REPO` container in the standard way described above, then do: +If `/my/custom/config-file` is the path and name of your custom configuration file, you can start your `%%REPO%%` container like this (note that only the directory path of the custom config file is used in this command): - docker exec -it some-%%REPO%% cat /etc/mysql/my.cnf > /my/custom/config-file + docker run --name some-%%REPO%% -v /my/custom:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag -... where `/my/custom/config-file` is the path and name of the new configuration file. Then start a new `%%REPO%%` container like this: - - docker run --name new-conf-%%REPO%% -v /my/custom/config-file:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%REPO%%:tag - -This will start a new container `new-conf-%%REPO%%` where the MySQL instance uses the startup options specified in `/my/custom/config-file`. +This will start a new container `some-%%REPO%%` where the MySQL instance uses the combined startup settings from `/etc/mysql/my.cnf` and `/etc/mysql/conf.d/config-file`, with settings from the latter taking precedence. Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to your new config file so that the container will be allowed to mount it: - chcon -Rt svirt_sandbox_file_t /my/custom/config-file + chcon -Rt svirt_sandbox_file_t /my/custom ## Environment Variables