MYSQL docker文件 [英] MYSQL docker file

查看:34
本文介绍了MYSQL docker文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个如下所示的mysql docker文件:

I have a mysql docker file as follows:

FROM mysql:latest

ENV MYSQL_ROOT_PASSWORD password
ENV MYSQL_DATABASE database
ENV MYSQL_USER root  
ENV MYSQL_PASSWORD mysql007
ENV COMPOSE_CONVERT_WINDOWS_PATHS 1

COPY init.sql /docker-entrypoint-initdb.d/

RUN chmod a+x /docker-entrypoint-initdb.d/init.sql && chown root:root     /docker-entrypoint-initdb.d/init.sql

EXPOSE 3306
CMD ["mysqld"]

我在docker终端上使用以下命令构建文件:

I build the file using the following command on docker terminal:

docker build --build-arg http_proxy=<value> --build-arg https_proxy=<value> -f mySQL_Dockerfile -t mysql .

每当我运行docker文件时,它都会给我以下日志并退出:

Whenever I run the docker file it gives me the following log and exits:

Initializing database
2017-03-14T08:58:57.139375Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-03-14T08:58:57.538155Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-03-14T08:58:57.667334Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-03-14T08:58:57.726216Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 757aecb4-0894-11e7-9b9f-0242
ac110002.
2017-03-14T08:58:57.729630Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-03-14T08:58:57.732463Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2017-03-14T08:59:02.299741Z 1 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:02.299874Z 1 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:02.299916Z 1 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:02.299950Z 1 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:02.300070Z 1 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
Database initialized
Initializing certificates
Generating a 2048 bit RSA private key
.....+++
.......................................+++
unable to write 'random state'
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
...............+++
..........+++
unable to write 'random state'
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
..............................+++
............+++
unable to write 'random state'
writing new private key to 'client-key.pem'
-----
Certificates initialized
MySQL init process in progress...
2017-03-14T08:59:05.114256Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-03-14T08:59:05.118407Z 0 [Note] mysqld (mysqld 5.7.17) starting as process 77 ...
2017-03-14T08:59:05.121736Z 0 [Note] InnoDB: PUNCH HOLE support available
2017-03-14T08:59:05.121870Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-14T08:59:05.121904Z 0 [Note] InnoDB: Uses event mutexes
2017-03-14T08:59:05.121942Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-03-14T08:59:05.121958Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-03-14T08:59:05.121974Z 0 [Note] InnoDB: Using Linux native AIO
2017-03-14T08:59:05.122514Z 0 [Note] InnoDB: Number of pools: 1
2017-03-14T08:59:05.122715Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-03-14T08:59:05.124223Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-03-14T08:59:05.135947Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-03-14T08:59:05.137985Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2017-03-14T08:59:05.150094Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2017-03-14T08:59:05.161065Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2017-03-14T08:59:05.161215Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2017-03-14T08:59:05.337319Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2017-03-14T08:59:05.341242Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2017-03-14T08:59:05.341492Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2017-03-14T08:59:05.345441Z 0 [Note] InnoDB: Waiting for purge to start
2017-03-14T08:59:05.395911Z 0 [Note] InnoDB: 5.7.17 started; log sequence number 2534561
2017-03-14T08:59:05.397917Z 0 [Note] Plugin 'FEDERATED' is disabled.
2017-03-14T08:59:05.405692Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2017-03-14T08:59:05.431196Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2017-03-14T08:59:05.431990Z 0 [Warning] CA certificate ca.pem is self signed.
2017-03-14T08:59:05.434311Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170314  8:59:05
2017-03-14T08:59:05.444568Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:05.444699Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:05.444743Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:05.444773Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:05.446269Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:05.451149Z 0 [Note] Event Scheduler: Loaded 0 events
2017-03-14T08:59:05.451397Z 0 [Note] Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of tables using the deprecated partition engine. You may use the startup option '--disable-parti
tion-engine-check' to skip this check.
2017-03-14T08:59:05.451433Z 0 [Note] Beginning of list of non-natively partitioned tables
2017-03-14T08:59:05.460184Z 0 [Note] End of list of non-natively partitioned tables
2017-03-14T08:59:05.460451Z 0 [Note] mysqld: ready for connections.
Version: '5.7.17'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server (GPL)
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
2017-03-14T08:59:08.290703Z 5 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:08.290960Z 5 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:08.291016Z 5 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:08.291115Z 5 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:08.291157Z 5 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1396 (HY000) at line 1: Operation CREATE USER failed for 'root'@'%'

任何想法可能是什么问题?它说根用户创建失败并退出!

Any idea what the problem could be? It says the root user creation failed and exits!

谢谢.

推荐答案

提出建议的答案,但适用于不同版本的mysql映像.它似乎不适用于 mysql:latest .我更改为 mysql:5.7 ,建议的解决方案效果很好.

Turns out the suggested answer works but on a different version of the mysql image. It doesn't seem to be working for mysql:latest. I changed to mysql:5.7 and the suggested solution worked just fine.

这篇关于MYSQL docker文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆