Public | Automated BUILD Cytopia/mysql-8.0Last pushed: 8 months ago
- Repo Info
- Tags
- Dockerfile
- Build Details
Short DescriptionMySQL 8.0 on CentOS 7Full DescriptionMySQL 8.0 Docker
<small>latest build:2017-08-30</small>
MySQL 5.5 | MySQL 5.6 | MySQL 5.7 | MySQL 8.0 | MARIADB 5.5 | MARIADB 10.0 | MARIADB 10.1 | MARIADB 10.2 | MARIADB 10.3 | Percona 5.5 | Percona 5.6 | Percona 5.7
MySQL 8.0 Docker on CentOS 7
<sub>this Docker image is part of the devilbox</sub>
Optionsenvironmental variablesrequired Environmental variables
Variable |
Type |
Description |
Mysql_root_password |
String |
MySQL root user password of either existing database or in case it does not exist it would initialize the new database with The given password. |
Optional Environmental variables
Variable |
Type |
Default |
Description |
Debug_compose_entrypoint |
bool |
0 |
Show shell commands executed during start.<br/>value: 0 or1 |
TIMEZONE |
String |
UTC |
Set Docker OS Timezone.<br/>example:Europe/Berlin |
Mysql_socket_dir |
String |
/var/sock/mysqld |
Path inside the Docker to the socket directory.<br/><br/>used to separate sockets directory from data directory In order to mount it to the Docker host or other Docker containers.<br/><br/>mount this directory to a PHP co Ntainer and is able to use mysqli_connect with localhost . |
Mysql_general_log |
bool |
0 |
Turn on or off general logging<br/>corresponds to MySQL config: general-log <br/>value: 0 or1 |
Default mount points
Docker |
Description |
/var/lib/mysql |
MySQL Data dir |
/var/log/mysql |
MySQL Log dir |
/var/sock/mysqld |
MySQL Socket dir |
/etc/mysql/conf.d |
MySQL configuration directory (used to overwrite MySQL config) |
/etc/mysql/docker-default.d |
MySQL configuration directory (used to overwrite MySQL config) |
Default ports
Docker |
Description |
3306 |
MySQL Listening Port |
Usage
1. Listen on loopback interface only
$ docker run -i -p 127.0.0.1:3306:3306 -e MYSQL_ROOT_PASSWORD=my-secret-pw -t cytopia/mysql-8.0# Access MySQL from your host computer$ mysql --user=root --password=my-secret-pw --host=127.0.0.1 -e ‘show databases;‘
2. Enable Logging
Enable logging and mount the log directory to your host to~tmp/mysql-log
$ docker run -i -p 127.0.0.1:3306:3306 -v ~tmp/mysql-log:/var/log/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -e MYSQL_GENERAL_LOG=1 -t cytopia/mysql-8.0# Access MySQL from your host computer$ mysql --user=root --password=my-secret-pw --host=127.0.0.1 -e ‘show databases;‘
3. Mount MySQL socket to the host
Use a MySQL socket for localhost
connections through the socket. No need to expose the "MySQL port to the host" case.
$ docker run -i -v ~tmp/mysql-sock:/var/sock/mysqld -e MYSQL_ROOT_PASSWORD=my-secret-pw -t cytopia/mysql-8.0# Access MySQL from your host computer via socket$ mysql --user=root --password=my-secret-pw --socket=/var/sock/mysqld/mysqld.sock -e ‘show databases;‘
4. Overwrite Configuration
You can also add no configuration settings prior startup to MySQL.
# Create local config with buffer overwrite$ printf "[mysqld]\n%s\n" "key_buffer = 500M" > ~/tmp/mysqld_config/buffer.cnf$ docker run -i -p 127.0.0.1:3306:3306 -v ~/tmp/mysqld_config:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=my-secret-pw -t cytopia/mysql-8.0
MySQL Configuration Overview
Configuration files inside this docker is read in the following order:
Order |
File |
Description |
1 |
/etc/my.cnf |
Operating system default |
2 |
/etc/mysql/conf.d/ |
Custom configuration (Level 1). Can is mounted to provide custom *.cnf files which can overwrite anything of the above. (used by the Devilbox to its base configuration) |
3 |
/etc/mysql/docker-default.d/*.cnf |
Custom configuration (Level 2). Can is mounted to provide custom *.cnf files which can overwrite anything of the above. (used by the Devilbox to allow custom user-defined configuration overwriting the default Devilbox settings. |
Modules
[Version]
/usr/sbin/mysqld Ver 8.0.2-DMR for Linux on x86_64 (MySQL Community Server (GPL))
MySQL 8.0 Docker usage annotations