MySQL8.0がDockerリポジトリーで提供されているので、Dockerに8.0のイメージをダウンロードしてインストールしてみました。
同時にMySQL8.0の新機能確認として、動的にGlobal Variablesを変更して永続化出来るか?また、データディクショナリの状況も確認してみました。

■ DockerレポジトリーとイメージTag
https://hub.docker.com/r/mysql/mysql-server/
https://hub.docker.com/r/mysql/mysql-server/tags/

MySQL8.0 Dockerイメージダウンロード~起動まで


[root@DockerHost oracle]# docker pull mysql/mysql-server:8.0
8.0: Pulling from mysql/mysql-server
7f369f1cac0b: Pull complete 
897fddccf3d8: Pull complete 
865c22dab1e4: Pull complete 
3e61c960af44: Pull complete 
fcd95ea99f45: Pull complete 
e9cae96efb21: Pull complete 
671450fab9a5: Pull complete 
1b8291aef5a7: Pull complete 
99ef814fb233: Pull complete 
c1add8e582f0: Pull complete 
Digest: sha256:c65b1da17c01749a28fc0b0865f94bf02053f290f23a28bf4fe9d8447dccadd6
Status: Downloaded newer image for mysql/mysql-server:8.0
[root@DockerHost oracle]# docker images
REPOSITORY           TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
mysql/mysql-server   8.0                 c1add8e582f0        5 days ago          393.4 MB
mysql/mysql-server   5.7.12              4e1d42e32c43        5 months ago        296.7 MB
mysql                5.7.10              ea0aca21950d        9 months ago        360.3 MB
mysql/mysql-server   5.7.10              e472f1765697        9 months ago        294.6 MB
[root@DockerHost oracle]# 

[root@DockerHost oracle]# docker run --name mysql8 -v /docker/docker8:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=mysql -d mysql/mysql-server:8.0
f0d7a1a715633b76aaadbba8b8fa6a63b293a9a88d193d28cd44cebd33d08955
[root@DockerHost oracle]# 

[root@DockerHost oracle]# docker ps -a
CONTAINER ID        IMAGE                       COMMAND                  CREATED              STATUS                    PORTS                 NAMES
f0d7a1a71563        mysql/mysql-server:8.0      "/entrypoint.sh mysql"   About a minute ago   Up About a minute         3306/tcp, 33060/tcp   mysql8
88da7fe02e00        mysql:5.7.10                "/entrypoint.sh mysql"   3 months ago         Exited (0) 3 months ago                         my_docker03
4fde03dc4cb5        mysql/mysql-server:5.7.10   "/entrypoint.sh mysql"   8 months ago         Exited (0) 3 months ago                         my_docker02
5152a22b2aa0        mysql:5.7.10                "/entrypoint.sh mysql"   8 months ago         Exited (0) 8 months ago                         my_docker01
[root@DockerHost oracle]# 

[root@DockerHost oracle]# docker inspect -f "{{.Config.Hostname}}, {{.NetworkSettings.IPAddress}}" $(docker ps | grep -v "^CONTAINER" | awk '{print $1}')
f0d7a1a71563, 172.17.0.2
[root@DockerHost oracle]# 

ログインしてバージョン確認

[root@DockerHost oracle]# docker exec -it mysql8 mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 8.0.0-dmr MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 8.0.0-dmr |
+-----------+
1 row in set (0.00 sec)

mysql> 

■ SET PERSIST Statementの確認
http://mysqlserverteam.com/mysql-8-0-persisting-configuration-variables/


mysql> SELECT * FROM performance_schema.variables_info WHERE variable_source != 'COMPILED';
+--------------------+-----------------+---------------+-----------+-----------+
| VARIABLE_NAME      | VARIABLE_SOURCE | VARIABLE_PATH | MIN_VALUE | MAX_VALUE |
+--------------------+-----------------+---------------+-----------+-----------+
| datadir            | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| foreign_key_checks | DYNAMIC         |               | 0         | 0         |
| log_error          | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| pid_file           | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| secure_file_priv   | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| skip_name_resolve  | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| socket             | GLOBAL          | /etc/my.cnf   | 0         | 0         |
+--------------------+-----------------+---------------+-----------+-----------+
7 rows in set (0.00 sec)

mysql> show variables like 'log_timestamps';                                               
+----------------+-------+
| Variable_name  | Value |
+----------------+-------+
| log_timestamps | UTC   |
+----------------+-------+
1 row in set (0.01 sec)

mysql> SET PERSIST log_timestamps='SYSTEM';
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'log_timestamps';                                               
+----------------+--------+
| Variable_name  | Value  |
+----------------+--------+
| log_timestamps | SYSTEM |
+----------------+--------+
1 row in set (0.00 sec)

mysql> SELECT * FROM performance_schema.variables_info WHERE variable_source != 'COMPILED';
+--------------------+-----------------+---------------+-----------+-----------+
| VARIABLE_NAME      | VARIABLE_SOURCE | VARIABLE_PATH | MIN_VALUE | MAX_VALUE |
+--------------------+-----------------+---------------+-----------+-----------+
| datadir            | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| foreign_key_checks | DYNAMIC         |               | 0         | 0         |
| log_error          | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| log_timestamps     | DYNAMIC         |               | 0         | 0         |
| pid_file           | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| secure_file_priv   | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| skip_name_resolve  | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| socket             | GLOBAL          | /etc/my.cnf   | 0         | 0         |
+--------------------+-----------------+---------------+-----------+-----------+
8 rows in set (0.00 sec)

mysql> 

再起動後も値が反映されている事を確認


[root@DockerHost oracle]# docker stop f0d7a1a71563
f0d7a1a71563
[root@DockerHost oracle]# docker ps -a
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                     PORTS               NAMES
f0d7a1a71563        mysql/mysql-server:8.0      "/entrypoint.sh mysql"   11 minutes ago      Exited (0) 2 seconds ago                       mysql8
88da7fe02e00        mysql:5.7.10                "/entrypoint.sh mysql"   3 months ago        Exited (0) 3 months ago                        my_docker03
4fde03dc4cb5        mysql/mysql-server:5.7.10   "/entrypoint.sh mysql"   8 months ago        Exited (0) 3 months ago                        my_docker02
5152a22b2aa0        mysql:5.7.10                "/entrypoint.sh mysql"   8 months ago        Exited (0) 8 months ago                        my_docker01
[root@DockerHost oracle]# docker start f0d7a1a71563
f0d7a1a71563
[root@DockerHost oracle]# docker ps -a
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                    PORTS                 NAMES
f0d7a1a71563        mysql/mysql-server:8.0      "/entrypoint.sh mysql"   11 minutes ago      Up 2 seconds              3306/tcp, 33060/tcp   mysql8
88da7fe02e00        mysql:5.7.10                "/entrypoint.sh mysql"   3 months ago        Exited (0) 3 months ago                         my_docker03
4fde03dc4cb5        mysql/mysql-server:5.7.10   "/entrypoint.sh mysql"   8 months ago        Exited (0) 3 months ago                         my_docker02
5152a22b2aa0        mysql:5.7.10                "/entrypoint.sh mysql"   8 months ago        Exited (0) 8 months ago                         my_docker01
[root@DockerHost oracle]# 

[root@DockerHost oracle]# docker exec -it mysql8 mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 8.0.0-dmr MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show variables like 'log_timestamps';
+----------------+--------+
| Variable_name  | Value  |
+----------------+--------+
| log_timestamps | SYSTEM |
+----------------+--------+
1 row in set (0.02 sec)

mysql> 

(補足) SET PERSISTで設定変更した、GLOBAL変数は以下のようにmysqld-auto.cnfから読み込まれています。

Under the hood the settings will be persisted to a file named mysqld-auto.cnf which will be created in the data directory.
This file will be read during server startup just like any other configuration file, and all variables present in this file will be applied as the highest priority.
That means the file mysqld-auto.cnf will be the last file to be applied on server startup (even after command-line options) and takes precedence if a specific setting has been specified in more than one location.


mysql>  select VARIABLE_NAME,VARIABLE_SOURCE,VARIABLE_PATH from performance_schema.variables_info where VARIABLE_PATH <> '';
+-------------------+-----------------+--------------------------------+
| VARIABLE_NAME     | VARIABLE_SOURCE | VARIABLE_PATH                  |
+-------------------+-----------------+--------------------------------+
| datadir           | GLOBAL          | /etc/my.cnf                    |
| log_error         | GLOBAL          | /etc/my.cnf                    |
| log_timestamps    | PERSISTED       | /var/lib/mysql/mysqld-auto.cnf |
| pid_file          | GLOBAL          | /etc/my.cnf                    |
| secure_file_priv  | GLOBAL          | /etc/my.cnf                    |
| skip_name_resolve | GLOBAL          | /etc/my.cnf                    |
| socket            | GLOBAL          | /etc/my.cnf                    |
+-------------------+-----------------+--------------------------------+
7 rows in set (0.00 sec)

mysql> 

■MySQL8.0データディクショナリの確認


[root@DockerHost var]# docker exec -it mysql8 mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.0-dmr MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> source /var/lib/mysql/init-docker-sakila.sql

Query OK, 200 rows affected (0.01 sec)
Records: 200  Duplicates: 0  Warnings: 0

Query OK, 603 rows affected (0.04 sec)
Records: 603  Duplicates: 0  Warnings: 0

Query OK, 600 rows affected (0.01 sec)
Records: 600  Duplicates: 0  Warnings: 0

<SNIP>

Query OK, 109 rows affected (0.01 sec)
Records: 109  Duplicates: 0  Warnings: 0

Query OK, 599 rows affected (0.04 sec)
Records: 599  Duplicates: 0  Warnings: 0

Query OK, 1000 rows affected (0.17 sec)
Records: 1000  Duplicates: 0  Warnings: 0

Query OK, 5462 rows affected (0.18 sec)
Records: 5462  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sakila             |
| sys                |
+--------------------+
5 rows in set (0.01 sec)

mysql> 

■ MySQL8.0で作成したSakilaサンプルデータベースのデータディクショナリー確認

[root@DockerHost sakila]# ls -l /docker/docker8/sakila
total 25104
-rw-r----- 1 27 27   147456 Sep 20 13:55 actor.ibd
-rw-r----- 1 27 27   278528 Sep 20 13:55 address.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 category.ibd
-rw-r----- 1 27 27   147456 Sep 20 13:55 city.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 country.ibd
-rw-r----- 1 27 27   229376 Sep 20 13:55 customer.ibd
-rw-r----- 1 27 27   376832 Sep 20 13:55 film_actor.ibd
-rw-r----- 1 27 27   180224 Sep 20 13:55 film_category.ibd
-rw-r----- 1 27 27   376832 Sep 20 13:55 film.ibd
-rw-r----- 1 27 27   294912 Sep 20 13:55 film_text.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_00000000000000ae_INDEX_1.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_00000000000000ae_INDEX_2.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_00000000000000ae_INDEX_3.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_00000000000000ae_INDEX_4.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_00000000000000ae_INDEX_5.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_00000000000000ae_INDEX_6.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_BEING_DELETED_CACHE.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_BEING_DELETED.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_CONFIG.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_DELETED_CACHE.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_DELETED.ibd
-rw-r----- 1 27 27   475136 Sep 20 13:56 inventory.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 language.ibd
-rw-r----- 1 27 27 10485760 Sep 20 13:56 payment.ibd
-rw-r----- 1 27 27 10485760 Sep 20 13:56 rental.ibd
-rw-r----- 1 27 27   180224 Sep 20 13:55 staff.ibd
-rw-r----- 1 27 27   163840 Sep 20 13:55 store.ibd
[root@DockerHost sakila]# 

■ MySQL5.7で作成したSakilaサンプルデータベースのデータディクショナリー確認
frmやTRGファイルが存在しています。


[root@DockerHost sakila]# ls -l /docker/docker03/sakila/
total 24620
-rw-r----- 1 999 999     8694 Jun  7 07:17 actor.frm
-rw-r----- 1 999 999   114688 Jun  7 07:17 actor.ibd
-rw-r----- 1 999 999     2863 Jun  7 07:17 actor_info.frm
-rw-r----- 1 999 999     8878 Jun  7 07:17 address.frm
-rw-r----- 1 999 999   245760 Jun  7 07:17 address.ibd
-rw-r----- 1 999 999     8648 Jun  7 07:17 category.frm
-rw-r----- 1 999 999    98304 Jun  7 07:17 category.ibd
-rw-r----- 1 999 999     8682 Jun  7 07:17 city.frm
-rw-r----- 1 999 999   114688 Jun  7 07:17 city.ibd
-rw-r----- 1 999 999     8652 Jun  7 07:17 country.frm
-rw-r----- 1 999 999    98304 Jun  7 07:17 country.ibd
-rw-r----- 1 999 999       40 Jun  7 07:17 customer_create_date.TRN
-rw-r----- 1 999 999     8890 Jun  7 07:17 customer.frm
-rw-r----- 1 999 999   196608 Jun  7 07:17 customer.ibd
-rw-r----- 1 999 999     1892 Jun  7 07:17 customer_list.frm
-rw-r----- 1 999 999      300 Jun  7 07:17 customer.TRG
-rw-r----- 1 999 999       61 Jun  7 07:17 db.opt
-rw-r----- 1 999 999       36 Jun  7 07:17 del_film.TRN
-rw-r----- 1 999 999     8648 Jun  7 07:17 film_actor.frm
-rw-r----- 1 999 999   344064 Jun  7 07:17 film_actor.ibd
-rw-r----- 1 999 999     8654 Jun  7 07:17 film_category.frm
-rw-r----- 1 999 999   147456 Jun  7 07:17 film_category.ibd
-rw-r----- 1 999 999     9188 Jun  7 07:17 film.frm
-rw-r----- 1 999 999   344064 Jun  7 07:17 film.ibd
-rw-r----- 1 999 999     2616 Jun  7 07:17 film_list.frm
-rw-r----- 1 999 999     8642 Jun  7 07:17 film_text.frm
-rw-r----- 1 999 999   262144 Jun  7 07:17 film_text.ibd
-rw-r----- 1 999 999     1093 Jun  7 07:17 film.TRG
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_0000000000000045_INDEX_1.ibd
-rw-r----- 1 999 999   131072 Jun  7 07:17 FTS_0000000000000035_0000000000000045_INDEX_2.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_0000000000000045_INDEX_3.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_0000000000000045_INDEX_4.ibd
-rw-r----- 1 999 999   131072 Jun  7 07:17 FTS_0000000000000035_0000000000000045_INDEX_5.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_0000000000000045_INDEX_6.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_BEING_DELETED_CACHE.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_BEING_DELETED.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_CONFIG.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_DELETED_CACHE.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_DELETED.ibd
-rw-r----- 1 999 999       36 Jun  7 07:17 ins_film.TRN
-rw-r----- 1 999 999     8694 Jun  7 07:17 inventory.frm
-rw-r----- 1 999 999   442368 Jun  7 07:17 inventory.ibd
-rw-r----- 1 999 999     8648 Jun  7 07:17 language.frm
-rw-r----- 1 999 999    98304 Jun  7 07:17 language.ibd
-rw-r----- 1 999 999     3234 Jun  7 07:17 nicer_but_slower_film_list.frm
-rw-r----- 1 999 999       39 Jun  7 07:17 payment_date.TRN
-rw-r----- 1 999 999     8818 Jun  7 07:17 payment.frm
-rw-r----- 1 999 999 10485760 Jun  7 07:17 payment.ibd
-rw-r----- 1 999 999      292 Jun  7 07:17 payment.TRG
-rw-r----- 1 999 999       38 Jun  7 07:17 rental_date.TRN
-rw-r----- 1 999 999     8830 Jun  7 07:17 rental.frm
-rw-r----- 1 999 999 10485760 Jun  7 07:17 rental.ibd
-rw-r----- 1 999 999      289 Jun  7 07:17 rental.TRG
-rw-r----- 1 999 999     1669 Jun  7 07:17 sales_by_film_category.frm
-rw-r----- 1 999 999     2344 Jun  7 07:17 sales_by_store.frm
-rw-r----- 1 999 999     8952 Jun  7 07:17 staff.frm
-rw-r----- 1 999 999   147456 Jun  7 07:17 staff.ibd
-rw-r----- 1 999 999     1705 Jun  7 07:17 staff_list.frm
-rw-r----- 1 999 999     8708 Jun  7 07:17 store.frm
-rw-r----- 1 999 999   131072 Jun  7 07:17 store.ibd
-rw-r----- 1 999 999       36 Jun  7 07:17 upd_film.TRN

メモ:MySQL8.0 DATA DICTIONARY

Data dictionary tables are invisible. They cannot be read with SELECT, do not appear in the output of SHOW TABLES,
are not listed in the INFORMATION_SCHEMA.TABLES table, and so forth. However, in most cases there are corresponding INFORMATION_SCHEMA tables
that can be queried. Conceptually, the INFORMATION_SCHEMA provides a view through which MySQL exposes data dictionary metadata.
For example, you cannot select from the mysql.schemata table directly:
http://dev.mysql.com/doc/refman/8.0/en/system-database.html#system-database-data-dictionary-tables


mysql> SELECT * FROM mysql.schemata;                                                                         
ERROR 3554 (HY000): Access to system table 'mysql.schemata' is rejected.
mysql> 

mysql> SELECT * FROM INFORMATION_SCHEMA.SCHEMATA limit 10; 
+--------------+--------------------+----------------------------+------------------------+----------+
| CATALOG_NAME | SCHEMA_NAME        | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | SQL_PATH |
+--------------+--------------------+----------------------------+------------------------+----------+
| def          | mysql              | latin1                     | latin1_swedish_ci      |     NULL |
| def          | information_schema | utf8                       | utf8_general_ci        |     NULL |
| def          | performance_schema | utf8                       | utf8_general_ci        |     NULL |
| def          | sys                | utf8                       | utf8_general_ci        |     NULL |
| def          | sakila             | latin1                     | latin1_swedish_ci      |     NULL |
+--------------+--------------------+----------------------------+------------------------+----------+
5 rows in set (0.00 sec)

mysql> select * from INNODB_SYS_TABLES where NAME LIKE 'sakila%';
+----------+------------------------------------------------------+------+--------+-------+------------+---------------+------------+
| TABLE_ID | NAME                                                 | FLAG | N_COLS | SPACE | ROW_FORMAT | ZIP_PAGE_SIZE | SPACE_TYPE |
+----------+------------------------------------------------------+------+--------+-------+------------+---------------+------------+
|       97 | sakila/FTS_000000000000005b_00000000000000ae_INDEX_1 |   33 |      8 |    85 | Dynamic    |             0 | Single     |
|       98 | sakila/FTS_000000000000005b_00000000000000ae_INDEX_2 |   33 |      8 |    86 | Dynamic    |             0 | Single     |
|       99 | sakila/FTS_000000000000005b_00000000000000ae_INDEX_3 |   33 |      8 |    87 | Dynamic    |             0 | Single     |
|      100 | sakila/FTS_000000000000005b_00000000000000ae_INDEX_4 |   33 |      8 |    88 | Dynamic    |             0 | Single     |
|      101 | sakila/FTS_000000000000005b_00000000000000ae_INDEX_5 |   33 |      8 |    89 | Dynamic    |             0 | Single     |
|      102 | sakila/FTS_000000000000005b_00000000000000ae_INDEX_6 |   33 |      8 |    90 | Dynamic    |             0 | Single     |
|       92 | sakila/FTS_000000000000005b_BEING_DELETED            |   33 |      4 |    80 | Dynamic    |             0 | Single     |
|       93 | sakila/FTS_000000000000005b_BEING_DELETED_CACHE      |   33 |      4 |    81 | Dynamic    |             0 | Single     |
|       94 | sakila/FTS_000000000000005b_CONFIG                   |   33 |      5 |    82 | Dynamic    |             0 | Single     |
|       95 | sakila/FTS_000000000000005b_DELETED                  |   33 |      4 |    83 | Dynamic    |             0 | Single     |
|       96 | sakila/FTS_000000000000005b_DELETED_CACHE            |   33 |      4 |    84 | Dynamic    |             0 | Single     |
|      109 | sakila/OPC                                           |   33 |      4 |   100 | Dynamic    |             0 | Single     |
|       82 | sakila/actor                                         |   33 |      7 |    70 | Dynamic    |             0 | Single     |
|       83 | sakila/address                                       |   33 |     12 |    71 | Dynamic    |             0 | Single     |
|       84 | sakila/category                                      |   33 |      6 |    72 | Dynamic    |             0 | Single     |
|       85 | sakila/city                                          |   33 |      7 |    73 | Dynamic    |             0 | Single     |
|       86 | sakila/country                                       |   33 |      6 |    74 | Dynamic    |             0 | Single     |
|       87 | sakila/customer                                      |   33 |     12 |    75 | Dynamic    |             0 | Single     |
|       88 | sakila/film                                          |   33 |     16 |    76 | Dynamic    |             0 | Single     |
|       89 | sakila/film_actor                                    |   33 |      6 |    77 | Dynamic    |             0 | Single     |
|       90 | sakila/film_category                                 |   33 |      6 |    78 | Dynamic    |             0 | Single     |
|       91 | sakila/film_text                                     |   33 |      7 |    79 | Dynamic    |             0 | Single     |
|      103 | sakila/inventory                                     |   33 |      7 |    91 | Dynamic    |             0 | Single     |
|      104 | sakila/language                                      |   33 |      6 |    92 | Dynamic    |             0 | Single     |
|      105 | sakila/payment                                       |   33 |     10 |    93 | Dynamic    |             0 | Single     |
|      106 | sakila/rental                                        |   33 |     10 |    94 | Dynamic    |             0 | Single     |
|      107 | sakila/staff                                         |   33 |     14 |    95 | Dynamic    |             0 | Single     |
|      108 | sakila/store                                         |   33 |      7 |    96 | Dynamic    |             0 | Single     |
+----------+------------------------------------------------------+------+--------+-------+------------+---------------+------------+
28 rows in set (0.00 sec)

mysql> select * from INNODB_SYS_DATAFILES limit 5;
+-------+------------------------------+
| SPACE | PATH                         |
+-------+------------------------------+
|     2 | ./mysql/version.ibd          |
|     3 | ./mysql/character_sets.ibd   |
|     4 | ./mysql/collations.ibd       |
|     5 | ./mysql/tablespaces.ibd      |
|     6 | ./mysql/tablespace_files.ibd |
+-------+------------------------------+
5 rows in set (0.01 sec)

mysql> 

■ 参照
15.6 Data Dictionary Usage Differences
The MySQL 8.0.0 Milestone Release is available


昨年からMySQLチームがオフィシャルレポジトリーをDockerに公開し、
最近少しずつ利用している方も増えてきて、
開発環境などでは簡単にDBが準備出来て工数削減も出来、
大活躍出来る仕組みなので簡単にレビューしておきます。

[Dockerレポジトリ]
https://hub.docker.com/_/mysql/ (Docker Team)
https://hub.docker.com/r/mysql/mysql-server/ (MySQL team at Oracle)

Tagに関しては、此方を確認下さい。(指定しない場合は、最新のイメージがダウンロードされます)
https://hub.docker.com/r/mysql/mysql-server/tags/

レポジトリーにはDockerのオフィシャルレポジトリーとMySQLチームが公開しているオフィシャルレポジトリーがあります。
イメージをPULLすると以下のような感じになります。

既に、docker pull mysql:5.7.10コマンドでDockerオフィシャルレポジトリからイメージをダウンロード済みの状態です。
追加で、MySQL@OracleのオフィシャルレポジトリーからDockerのイメージをダウンロードしてみます。
サイズだけ見ると、MySQL@Oracleのオフィシャルレポジトリーからダウンロードしたイメージの方がサイズは小さいです。


[root@DockerHost docker]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
mysql               5.7.10              ea0aca21950d        3 weeks ago         360.3 MB
[root@DockerHost docker]# docker pull mysql/mysql-server:5.7.10
5.7.10: Pulling from mysql/mysql-server
f359075ce4d8: Pull complete 
df9c05f5df07: Pull complete 
bea04efc3319: Pull complete 
14204cc431b4: Pull complete 
249d5b7b31c1: Pull complete 
70a368114c59: Pull complete 
c5b90de0636a: Pull complete 
59e355dc43f6: Pull complete 
f03e996fb5a3: Pull complete 
69497ffa3023: Pull complete 
e472f1765697: Pull complete 
Digest: sha256:c9266386460cfb302d21615bbe8f6a16166b2376eb371095df7cc9a1c9cf6da1
Status: Downloaded newer image for mysql/mysql-server:5.7.10
[root@DockerHost docker]# docker images
REPOSITORY           TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
mysql                5.7.10              ea0aca21950d        3 weeks ago         360.3 MB
mysql/mysql-server   5.7.10              e472f1765697        4 weeks ago         294.6 MB
[root@DockerHost docker]# 

Dockerオフィシャルイメージを利用してMySQLを構築してみます。
インスタンス作成時に、データディレクトリーを指定、オプションファイルを指定、インスタンス作成と同時に
データベース作成する為に以下のスクリプトを配置してあります。ソースを確認すると*.sqlか*.shを配置しておくと、
DB作成時に読み込んでSQL文を実行してくれます。(初期共通アカウントやDB作成に使えます)

run


[root@DockerHost docker]# ls -l /docker/init_script/sakila-db/init-docker-sakila.sql 
-rw-r--r-- 1 root root 3421501 Jan  8 01:01 /docker/init_script/sakila-db/init-docker-sakila.sql
[root@DockerHost docker]# 


[root@DockerHost docker]# docker ps -a 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@DockerHost docker]# docker run --name my_docker01 -v /docker/docker01:/var/lib/mysql -v /docker/option1:/etc/mysql/conf.d -v /docker/init_script/sakila-db:/docker-entrypoint-initdb.d -e MYSQL_ROOT_PASSWORD=mysql -d mysql:5.7.10
5152a22b2aa0c724bd260552205ebf566a21b9d854a54921f02a96e40817a930
[root@DockerHost docker]# docker ps -a 
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
5152a22b2aa0        mysql:5.7.10        "/entrypoint.sh mysql"   11 seconds ago      Up 9 seconds        3306/tcp            my_docker01
[root@DockerHost docker]# 

Docker Inspectコマンドでパスのマッピングを確認


[root@DockerHost docker]# docker inspect my_docker01 | egrep 'Source|Destination'
            "Source": "/docker/docker01",
            "Destination": "/var/lib/mysql",
            "Source": "/docker/option1",
            "Destination": "/etc/mysql/conf.d",
            "Source": "/docker/init_script/sakila-db",
            "Destination": "/docker-entrypoint-initdb.d",
[root@DockerHost docker]# 

作成したインスタンスに接続して、初期設定状態を確認してみます。
確認: インスタンス接続、オプションファイルの読み込み、初期DBの作成状態。

[root@DockerHost docker]# docker exec -it my_docker01 mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.10-log MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@localhost [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sakila             |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

root@localhost [(none)]> show tables from sakila;
+----------------------------+
| Tables_in_sakila           |
+----------------------------+
| actor                      |
| actor_info                 |
| address                    |
| category                   |
| city                       |
| country                    |
| customer                   |
| customer_list              |
| film                       |
| film_actor                 |
| film_category              |
| film_list                  |
| film_text                  |
| inventory                  |
| language                   |
| nicer_but_slower_film_list |
| payment                    |
| rental                     |
| sales_by_film_category     |
| sales_by_store             |
| staff                      |
| staff_list                 |
| store                      |
+----------------------------+
23 rows in set (0.07 sec)

root@localhost [(none)]> show variables like 'char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.04 sec)

root@localhost [(none)]> 

次に、MySQL@Oracleチームがオフィシャルに提供しているオフィシャルイメージを利用してインスタンスを作成してみます。
※こちらのイメージを利用する場合は、オプションファイルの指定方法が少し異なります。(/etc/my.cnf)


[root@DockerHost docker]# docker ps -a 
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
5152a22b2aa0        mysql:5.7.10        "/entrypoint.sh mysql"   53 minutes ago      Up 53 minutes       3306/tcp            my_docker01
[root@DockerHost docker]# docker run --name my_docker02 -v /docker/docker02:/var/lib/mysql -v /docker/init_script/sakila-db:/docker-entrypoint-initdb.d -e MYSQL_ROOT_PASSWORD=mysql -d mysql/mysql-server:5.7.10
f59d1fd222d7b15ff0f0dfa3879254730734e17451fde56aeb402279f355941e
[root@DockerHost docker]# docker ps -a 
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS               NAMES
f59d1fd222d7        mysql/mysql-server:5.7.10   "/entrypoint.sh mysql"   2 seconds ago       Up 1 seconds        3306/tcp            my_docker02
5152a22b2aa0        mysql:5.7.10                "/entrypoint.sh mysql"   53 minutes ago      Up 53 minutes       3306/tcp            my_docker01
[root@DockerHost docker]# 

作成したインスタンスとDBの確認。(こちらは、OptionファイルはしていないのでDefaultです)


[root@DockerHost docker]# docker exec -it my_docker02 mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.10 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sakila             |
| sys                |
+--------------------+
5 rows in set (0.02 sec)

mysql> show tables from sakila;
+----------------------------+
| Tables_in_sakila           |
+----------------------------+
| actor                      |
| actor_info                 |
| address                    |
| category                   |
| city                       |
| country                    |
| customer                   |
| customer_list              |
| film                       |
| film_actor                 |
| film_category              |
| film_list                  |
| film_text                  |
| inventory                  |
| language                   |
| nicer_but_slower_film_list |
| payment                    |
| rental                     |
| sales_by_film_category     |
| sales_by_store             |
| staff                      |
| staff_list                 |
| store                      |
+----------------------------+
23 rows in set (0.00 sec)

mysql> show variables like 'char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | latin1                     |
| character_set_connection | latin1                     |
| character_set_database   | latin1                     |
| character_set_filesystem | binary                     |
| character_set_results    | latin1                     |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.02 sec)

mysql> 

イメージは停止しても、削除(rm)しなければ継続利用出来るので以下のようにサービスを停止して再開しても、
作成したデータなどは無くならず利用する事が可能です。


[root@DockerHost docker]# docker ps -a 
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS               NAMES
f59d1fd222d7        mysql/mysql-server:5.7.10   "/entrypoint.sh mysql"   10 minutes ago      Up 10 minutes       3306/tcp            my_docker02
5152a22b2aa0        mysql:5.7.10                "/entrypoint.sh mysql"   About an hour ago   Up About an hour    3306/tcp            my_docker01
[root@DockerHost docker]# docker stop f59d1fd222d7
f59d1fd222d7
[root@DockerHost docker]# docker stop 5152a22b2aa0
5152a22b2aa0
[root@DockerHost docker]# docker ps -a 
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                      PORTS               NAMES
f59d1fd222d7        mysql/mysql-server:5.7.10   "/entrypoint.sh mysql"   11 minutes ago      Exited (0) 13 seconds ago                       my_docker02
5152a22b2aa0        mysql:5.7.10                "/entrypoint.sh mysql"   About an hour ago   Exited (0) 3 seconds ago                        my_docker01
[root@DockerHost docker]# docker start f59d1fd222d7
f59d1fd222d7
[root@DockerHost docker]# docker ps -a 
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                      PORTS               NAMES
f59d1fd222d7        mysql/mysql-server:5.7.10   "/entrypoint.sh mysql"   11 minutes ago      Up 2 seconds                3306/tcp            my_docker02
5152a22b2aa0        mysql:5.7.10                "/entrypoint.sh mysql"   About an hour ago   Exited (0) 20 seconds ago                       my_docker01
[root@DockerHost docker]# docker exec -it my_docker02 mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.10 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sakila             |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

mysql> 

補足: MySql@oracleチームのオフィシャルイメージの場合にオプションファイルを指定する場合は、以下のように実行します。


[root@DockerHost docker]# docker run --name my_docker02 -v /docker/docker02:/var/lib/mysql -v /docker/option2/my.cnf:/etc/my.cnf -v /docker/init_script/sakila-db:/docker-entrypoint-initdb.d -e MYSQL_ROOT_PASSWORD=mysql -d mysql/mysql-server:5.7.10
4fde03dc4cb5966bbfee79de92c2351f2b04812df77bf763b0e14755c3d51261
[root@DockerHost docker]# docker ps -a 
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                      PORTS               NAMES
4fde03dc4cb5        mysql/mysql-server:5.7.10   "/entrypoint.sh mysql"   22 seconds ago      Up 21 seconds               3306/tcp            my_docker02
5152a22b2aa0        mysql:5.7.10                "/entrypoint.sh mysql"   About an hour ago   Exited (0) 24 minutes ago                       my_docker01
[root@DockerHost docker]# 

[root@DockerHost docker]# docker inspect my_docker02 | egrep 'Source|Destination'
            "Source": "/docker/docker02",
            "Destination": "/var/lib/mysql",
            "Source": "/docker/option2/my.cnf",
            "Destination": "/etc/my.cnf",
            "Source": "/docker/init_script/sakila-db",
            "Destination": "/docker-entrypoint-initdb.d",
[root@DockerHost docker]# 

参考:
https://hub.docker.com/r/mysql/mysql-server/
http://datacharmer.blogspot.jp/2015/10/mysql-docker-operations-part-1-getting.html