Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql Dockerfile的输出不等于容器内运行的相同命令的输出_Mysql_Docker - Fatal编程技术网

Mysql Dockerfile的输出不等于容器内运行的相同命令的输出

Mysql Dockerfile的输出不等于容器内运行的相同命令的输出,mysql,docker,Mysql,Docker,我对Docker的一些行为感到困惑。我有一个在OSX主机上运行的最小Dockerfile: FROM ubuntu:16.04 RUN apt-get update -y && \ apt-get upgrade -y && \ apt-get install -y gcc \ build-essential \ libmysqlclient-dev RUN \ echo mysql-server mysql-server/root_pas

我对Docker的一些行为感到困惑。我有一个在OSX主机上运行的最小Dockerfile:

FROM ubuntu:16.04

RUN apt-get update -y && \
  apt-get upgrade -y && \
  apt-get install -y gcc \
  build-essential \
  libmysqlclient-dev

RUN \
  echo mysql-server mysql-server/root_password password womp | debconf-set-selections && \
  echo mysql-server mysql-server/root_password_again password womp | debconf-set-selections && \
    apt-get -y install mysql-server
我通过以下方式构建此图像:

docker build --tag wonk --file Dockerfile .
然后,我通过以下方式为该图像创建一个容器:

docker run -dit wonk
然后我找到容器的id:

docker ps -a
然后用它在容器内放置一个壳:

docker exec -it {{ CONTAINER_ID }} /bin/bash
如果我尝试从客户端内部启动mysql服务器:

/etc/init.d/mysql start
但这失败了

但是如果我从docker文件中删除整个second RUN命令,重复上述步骤,然后在容器中运行second RUN命令,我就可以启动mysql了

有人知道为什么会这样吗?任何建议都会很有帮助


编辑:事实上,尽管上述两个容器中的mysql版本相同,但在Dockerfile中安装mysql服务器的那一个最终的目录是
/var/lib/mysql
/var/run/mysqld
,但我从容器内部安装mysql服务器的容器中不存在这些目录。为什么会这样


/var/log/mysql/error.log的内容

2019-09-18T23:39:50.957874Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2019-09-18T23:39:50.981668Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2019-09-18T23:39:51.162825Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-09-18T23:39:51.164124Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.27-0ubuntu0.16.04.1) starting as process 3456 ...
2019-09-18T23:39:51.168209Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-09-18T23:39:51.168258Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-09-18T23:39:51.168289Z 0 [Note] InnoDB: Uses event mutexes
2019-09-18T23:39:51.168319Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-09-18T23:39:51.168349Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2019-09-18T23:39:51.168378Z 0 [Note] InnoDB: Using Linux native AIO
2019-09-18T23:39:51.168600Z 0 [Note] InnoDB: Number of pools: 1
2019-09-18T23:39:51.168719Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-09-18T23:39:51.169949Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-09-18T23:39:51.178954Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-09-18T23:39:51.181161Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-09-18T23:39:51.194860Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2019-09-18T23:39:51.216975Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-09-18T23:39:51.217101Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-09-18T23:39:51.285152Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2019-09-18T23:39:51.287382Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2019-09-18T23:39:51.287434Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2019-09-18T23:39:51.288015Z 0 [Note] InnoDB: Waiting for purge to start
2019-09-18T23:39:51.339200Z 0 [Note] InnoDB: 5.7.27 started; log sequence number 2625955
2019-09-18T23:39:51.340684Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2019-09-18T23:39:51.340844Z 0 [Note] Plugin 'FEDERATED' is disabled.
2019-09-18T23:39:51.343146Z 0 [Note] InnoDB: Buffer pool(s) load completed at 190918 23:39:51
2019-09-18T23:39:51.346475Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2019-09-18T23:39:51.346536Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2019-09-18T23:39:51.346580Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2019-09-18T23:39:51.346631Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2019-09-18T23:39:51.353776Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table storage engine for 'proxies_priv' doesn't have this option
2019-09-18T23:39:51.353845Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
2019-09-18T23:39:51.353946Z 0 [ERROR] Aborting

2019-09-18T23:39:51.354042Z 0 [Note] Binlog end
2019-09-18T23:39:51.354162Z 0 [Note] Shutting down plugin 'ngram'
2019-09-18T23:39:51.354209Z 0 [Note] Shutting down plugin 'partition'
2019-09-18T23:39:51.354246Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2019-09-18T23:39:51.354283Z 0 [Note] Shutting down plugin 'ARCHIVE'
2019-09-18T23:39:51.354318Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2019-09-18T23:39:51.354355Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2019-09-18T23:39:51.354390Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2019-09-18T23:39:51.354425Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2019-09-18T23:39:51.354461Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2019-09-18T23:39:51.354496Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2019-09-18T23:39:51.354531Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2019-09-18T23:39:51.354574Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2019-09-18T23:39:51.354612Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2019-09-18T23:39:51.354647Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2019-09-18T23:39:51.354683Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2019-09-18T23:39:51.354718Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2019-09-18T23:39:51.354753Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2019-09-18T23:39:51.354788Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2019-09-18T23:39:51.354823Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2019-09-18T23:39:51.354859Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2019-09-18T23:39:51.354897Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2019-09-18T23:39:51.354933Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2019-09-18T23:39:51.354968Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2019-09-18T23:39:51.355003Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2019-09-18T23:39:51.355039Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2019-09-18T23:39:51.355074Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2019-09-18T23:39:51.355109Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2019-09-18T23:39:51.355145Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2019-09-18T23:39:51.355180Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2019-09-18T23:39:51.355215Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2019-09-18T23:39:51.355251Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2019-09-18T23:39:51.355286Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2019-09-18T23:39:51.355321Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2019-09-18T23:39:51.355357Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2019-09-18T23:39:51.355392Z 0 [Note] Shutting down plugin 'InnoDB'
2019-09-18T23:39:51.355583Z 0 [Note] InnoDB: FTS optimize thread exiting.
2019-09-18T23:39:51.355914Z 0 [Note] InnoDB: Starting shutdown...
2019-09-18T23:39:51.462147Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2019-09-18T23:39:51.462633Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 190918 23:39:51
2019-09-18T23:39:52.922232Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2625974
2019-09-18T23:39:52.925597Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2019-09-18T23:39:52.925658Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2019-09-18T23:39:52.925694Z 0 [Note] Shutting down plugin 'MEMORY'
2019-09-18T23:39:52.925728Z 0 [Note] Shutting down plugin 'CSV'
2019-09-18T23:39:52.925763Z 0 [Note] Shutting down plugin 'MyISAM'
2019-09-18T23:39:52.925800Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2019-09-18T23:39:52.925902Z 0 [Note] Shutting down plugin 'sha256_password'
2019-09-18T23:39:52.925936Z 0 [Note] Shutting down plugin 'mysql_native_password'
2019-09-18T23:39:52.926081Z 0 [Note] Shutting down plugin 'binlog'
2019-09-18T23:39:52.926560Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2019-09-18T23:39:53.037681Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

通过在容器中运行
/etc/init.d/mysql start
,您是否可以对您面临的故障日志添加疑问?当然可以。我擦除了日志,重新运行了一次start命令,然后将内容复制到上面的错误日志中。