linux - MySQL将不会开始使用Dockerfile

标签 linux bash shell docker dockerfile

我试图用Dockerfile非交互地安装mysql(不问任何配置问题),我在how to use here-strings in the Dockerfile?中找到了解决方法:

但是现在当我尝试使用容器内的service mysql start启动mysql时遇到另一个问题,它将无法正常工作,我想知道为什么吗?因为当我在debian:buster image容器内手动进行安装时,它运行良好。

正如您在下面看到的那样,它不会启动:

root@839a7dc4869a:/# service --status-all
 [ ? ]  hwclock.sh
 [ - ]  mysql
root@839a7dc4869a:/# service mysql start
....................................................................................
....................................................................................
[info] MySQL Community Server 5.7.28 did not start. Please check logs for more details..

这是我的Dockerfile:
From debian:buster

RUN apt update

RUN apt install -y gnupg wget lsb-release

RUN wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb

RUN printf "1\n1\n4\n" | dpkg -i mysql-apt-config_0.8.13-1_all.deb

RUN apt update

RUN printf '%s\n' 'mysql-community-server mysql-community-server/root-pass password your_password' | debconf-set-selections && \
    printf '%s\n' 'mysql-community-server mysql-community-server/re-root-pass password your_password' | debconf-set-selections && \
    apt-get -y install mysql-server

CMD bash

这是使用less /var/log/mysql/error.log的日志文件
2020-01-07T21:47:54.400816Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-01-07T21:47:55.708390Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-01-07T21:47:55.886509Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-01-07T21:47:56.038387Z 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: 5d1f693e-3197-11ea-95e2-0242ac110002.
2020-01-07T21:47:56.040635Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-01-07T21:47:56.456659Z 0 [Warning] CA certificate ca.pem is self signed.
2020-01-07T21:47:56.740853Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2020-01-07T21:47:59.268086Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-01-07T21:47:59.269832Z 0 [Note] mysqld (mysqld 5.7.28) starting as process 334 ...
2020-01-07T21:47:59.274112Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-01-07T21:47:59.274187Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-01-07T21:47:59.274191Z 0 [Note] InnoDB: Uses event mutexes
2020-01-07T21:47:59.274194Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-01-07T21:47:59.274196Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-01-07T21:47:59.274199Z 0 [Note] InnoDB: Using Linux native AIO
2020-01-07T21:47:59.274482Z 0 [Note] InnoDB: Number of pools: 1
2020-01-07T21:47:59.274639Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-01-07T21:47:59.276370Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-01-07T21:47:59.281119Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-01-07T21:47:59.282302Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-01-07T21:47:59.294898Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-01-07T21:47:59.301611Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-01-07T21:47:59.301665Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-01-07T21:47:59.344888Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-01-07T21:47:59.345338Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-01-07T21:47:59.345345Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-01-07T21:47:59.346096Z 0 [Note] InnoDB: Waiting for purge to start
2020-01-07T21:47:59.396626Z 0 [Note] InnoDB: 5.7.28 started; log sequence number 2628227
2020-01-07T21:47:59.396804Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-01-07T21:47:59.396852Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-01-07T21:47:59.397717Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200107 21:47:59
2020-01-07T21:47:59.400400Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2020-01-07T21:47:59.400413Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2020-01-07T21:47:59.400770Z 0 [Warning] CA certificate ca.pem is self signed.
2020-01-07T21:47:59.400790Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2020-01-07T21:47:59.400992Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2020-01-07T21:47:59.401006Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2020-01-07T21:47:59.401021Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2020-01-07T21:47:59.403395Z 0 [Warning] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2020-01-07T21:47:59.408666Z 0 [Note] Event Scheduler: Loaded 0 events
2020-01-07T21:47:59.408808Z 0 [Note] Execution of init_file '/var/lib/mysql-files/7pxJ7t37bI' started.
2020-01-07T21:47:59.409234Z 0 [Note] Execution of init_file '/var/lib/mysql-files/7pxJ7t37bI' ended.
2020-01-07T21:47:59.409284Z 0 [Note] mysqld: ready for connections.
Version: '5.7.28'  socket: '/tmp/tmp.q7db4MMdAE/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
2020-01-07T21:47:59.409594Z 0 [Note] Giving 0 client threads a chance to die gracefully
2020-01-07T21:47:59.409606Z 0 [Note] Shutting down slave threads
2020-01-07T21:47:59.409609Z 0 [Note] Forcefully disconnecting 0 remaining clients
2020-01-07T21:47:59.409612Z 0 [Note] Event Scheduler: Purging the queue. 0 events
2020-01-07T21:47:59.409663Z 0 [Note] Binlog end
2020-01-07T21:47:59.409938Z 0 [Note] Shutting down plugin 'ngram'
2020-01-07T21:47:59.409944Z 0 [Note] Shutting down plugin 'partition'
2020-01-07T21:47:59.409946Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2020-01-07T21:47:59.409948Z 0 [Note] Shutting down plugin 'ARCHIVE'
2020-01-07T21:47:59.409950Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2020-01-07T21:47:59.409962Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2020-01-07T21:47:59.409964Z 0 [Note] Shutting down plugin 'MyISAM'
2020-01-07T21:47:59.409969Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2020-01-07T21:47:59.409971Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2020-01-07T21:47:59.409973Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2020-01-07T21:47:59.409975Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2020-01-07T21:47:59.409976Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2020-01-07T21:47:59.409978Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2020-01-07T21:47:59.409980Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2020-01-07T21:47:59.409981Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2020-01-07T21:47:59.409983Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2020-01-07T21:47:59.409985Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2020-01-07T21:47:59.409986Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2020-01-07T21:47:59.409988Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2020-01-07T21:47:59.409990Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2020-01-07T21:47:59.409991Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2020-01-07T21:47:59.409993Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2020-01-07T21:47:59.409995Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2020-01-07T21:47:59.409996Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2020-01-07T21:47:59.409998Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2020-01-07T21:47:59.409999Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2020-01-07T21:47:59.410001Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2020-01-07T21:47:59.410003Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2020-01-07T21:47:59.410004Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2020-01-07T21:47:59.410006Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2020-01-07T21:47:59.410008Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2020-01-07T21:47:59.410009Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2020-01-07T21:47:59.410011Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2020-01-07T21:47:59.410012Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2020-01-07T21:47:59.410014Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2020-01-07T21:47:59.410016Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2020-01-07T21:47:59.410017Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2020-01-07T21:47:59.410019Z 0 [Note] Shutting down plugin 'InnoDB'
2020-01-07T21:47:59.410083Z 0 [Note] InnoDB: FTS optimize thread exiting.
2020-01-07T21:47:59.410230Z 0 [Note] InnoDB: Starting shutdown...
2020-01-07T21:47:59.511556Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2020-01-07T21:47:59.511701Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 200107 21:47:59
2020-01-07T21:48:00.958542Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2628246
2020-01-07T21:48:00.960660Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-01-07T21:48:00.960692Z 0 [Note] Shutting down plugin 'MEMORY'
2020-01-07T21:48:00.960697Z 0 [Note] Shutting down plugin 'CSV'
2020-01-07T21:48:00.960701Z 0 [Note] Shutting down plugin 'sha256_password'
2020-01-07T21:48:00.960703Z 0 [Note] Shutting down plugin 'mysql_native_password'
2020-01-07T21:48:00.960789Z 0 [Note] Shutting down plugin 'binlog'
2020-01-07T21:48:00.962661Z 0 [Note] mysqld: Shutdown complete

这是我运行service mysql start后的日志文件:
2020-01-07T21:47:54.400816Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-01-07T21:47:55.708390Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-01-07T21:47:55.886509Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-01-07T21:47:56.038387Z 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: 5d1f693e-3197-11ea-95e2-0242ac110002.
2020-01-07T21:47:56.040635Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-01-07T21:47:56.456659Z 0 [Warning] CA certificate ca.pem is self signed.
2020-01-07T21:47:56.740853Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2020-01-07T21:47:59.268086Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-01-07T21:47:59.269832Z 0 [Note] mysqld (mysqld 5.7.28) starting as process 334 ...
2020-01-07T21:47:59.274112Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-01-07T21:47:59.274187Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-01-07T21:47:59.274191Z 0 [Note] InnoDB: Uses event mutexes
2020-01-07T21:47:59.274194Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-01-07T21:47:59.274196Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-01-07T21:47:59.274199Z 0 [Note] InnoDB: Using Linux native AIO
2020-01-07T21:47:59.274482Z 0 [Note] InnoDB: Number of pools: 1
2020-01-07T21:47:59.274639Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-01-07T21:47:59.276370Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-01-07T21:47:59.281119Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-01-07T21:47:59.282302Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-01-07T21:47:59.294898Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-01-07T21:47:59.301611Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-01-07T21:47:59.301665Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-01-07T21:47:59.344888Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-01-07T21:47:59.345338Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-01-07T21:47:59.345345Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-01-07T21:47:59.346096Z 0 [Note] InnoDB: Waiting for purge to start
2020-01-07T21:47:59.396626Z 0 [Note] InnoDB: 5.7.28 started; log sequence number 2628227
2020-01-07T21:47:59.396804Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-01-07T21:47:59.396852Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-01-07T21:47:59.397717Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200107 21:47:59
2020-01-07T21:47:59.400400Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2020-01-07T21:47:59.400413Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2020-01-07T21:47:59.400770Z 0 [Warning] CA certificate ca.pem is self signed.
2020-01-07T21:47:59.400790Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2020-01-07T21:47:59.400992Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2020-01-07T21:47:59.401006Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2020-01-07T21:47:59.401021Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2020-01-07T21:47:59.403395Z 0 [Warning] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2020-01-07T21:47:59.408666Z 0 [Note] Event Scheduler: Loaded 0 events
2020-01-07T21:47:59.408808Z 0 [Note] Execution of init_file '/var/lib/mysql-files/7pxJ7t37bI' started.
2020-01-07T21:47:59.409234Z 0 [Note] Execution of init_file '/var/lib/mysql-files/7pxJ7t37bI' ended.
2020-01-07T21:47:59.409284Z 0 [Note] mysqld: ready for connections.
Version: '5.7.28'  socket: '/tmp/tmp.q7db4MMdAE/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
2020-01-07T21:47:59.409594Z 0 [Note] Giving 0 client threads a chance to die gracefully
2020-01-07T21:47:59.409606Z 0 [Note] Shutting down slave threads
2020-01-07T21:47:59.409609Z 0 [Note] Forcefully disconnecting 0 remaining clients
2020-01-07T21:47:59.409612Z 0 [Note] Event Scheduler: Purging the queue. 0 events
2020-01-07T21:47:59.409663Z 0 [Note] Binlog end
2020-01-07T21:47:59.409938Z 0 [Note] Shutting down plugin 'ngram'
2020-01-07T21:47:59.409944Z 0 [Note] Shutting down plugin 'partition'
2020-01-07T21:47:59.409946Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2020-01-07T21:47:59.409948Z 0 [Note] Shutting down plugin 'ARCHIVE'
2020-01-07T21:47:59.409950Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2020-01-07T21:47:59.409962Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2020-01-07T21:47:59.409964Z 0 [Note] Shutting down plugin 'MyISAM'
2020-01-07T21:47:59.409969Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2020-01-07T21:47:59.409971Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2020-01-07T21:47:59.409973Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2020-01-07T21:47:59.409975Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2020-01-07T21:47:59.409976Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2020-01-07T21:47:59.409978Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2020-01-07T21:47:59.409980Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2020-01-07T21:47:59.409981Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2020-01-07T21:47:59.409983Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2020-01-07T21:47:59.409985Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2020-01-07T21:47:59.409986Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2020-01-07T21:47:59.409988Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2020-01-07T21:47:59.409990Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2020-01-07T21:47:59.409991Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2020-01-07T21:47:59.409993Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2020-01-07T21:47:59.409995Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2020-01-07T21:47:59.409996Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2020-01-07T21:47:59.409998Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2020-01-07T21:47:59.409999Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2020-01-07T21:47:59.410001Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2020-01-07T21:47:59.410003Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2020-01-07T21:47:59.410004Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2020-01-07T21:47:59.410006Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2020-01-07T21:47:59.410008Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2020-01-07T21:47:59.410009Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2020-01-07T21:47:59.410011Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2020-01-07T21:47:59.410012Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2020-01-07T21:47:59.410014Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2020-01-07T21:47:59.410016Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2020-01-07T21:47:59.410017Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2020-01-07T21:47:59.410019Z 0 [Note] Shutting down plugin 'InnoDB'
2020-01-07T21:47:59.410083Z 0 [Note] InnoDB: FTS optimize thread exiting.
2020-01-07T21:47:59.410230Z 0 [Note] InnoDB: Starting shutdown...
2020-01-07T21:47:59.511556Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2020-01-07T21:47:59.511701Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 200107 21:47:59
2020-01-07T21:48:00.958542Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2628246
2020-01-07T21:48:00.960660Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-01-07T21:48:00.960692Z 0 [Note] Shutting down plugin 'MEMORY'
2020-01-07T21:48:00.960697Z 0 [Note] Shutting down plugin 'CSV'
2020-01-07T21:48:00.960701Z 0 [Note] Shutting down plugin 'sha256_password'
2020-01-07T21:48:00.960703Z 0 [Note] Shutting down plugin 'mysql_native_password'
2020-01-07T21:48:00.960789Z 0 [Note] Shutting down plugin 'binlog'
2020-01-07T21:48:00.962661Z 0 [Note] mysqld: Shutdown complete

2020-01-07T21:59:26.471325Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2020-01-07T21:59:26.486959Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2020-01-07T21:59:26.643199Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-01-07T21:59:26.644096Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.28) starting as process 408 ...
2020-01-07T21:59:26.646176Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-01-07T21:59:26.646190Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-01-07T21:59:26.646193Z 0 [Note] InnoDB: Uses event mutexes
2020-01-07T21:59:26.646196Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-01-07T21:59:26.646198Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-01-07T21:59:26.646201Z 0 [Note] InnoDB: Using Linux native AIO
2020-01-07T21:59:26.646331Z 0 [Note] InnoDB: Number of pools: 1
2020-01-07T21:59:26.646391Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-01-07T21:59:26.647165Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-01-07T21:59:26.651798Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-01-07T21:59:26.653130Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-01-07T21:59:27.636212Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-01-07T21:59:27.642182Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-01-07T21:59:27.642232Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-01-07T21:59:27.689063Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-01-07T21:59:27.689519Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-01-07T21:59:27.689527Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-01-07T21:59:27.689913Z 0 [Note] InnoDB: Waiting for purge to start
2020-01-07T21:59:27.740941Z 0 [Note] InnoDB: 5.7.28 started; log sequence number 2628246
2020-01-07T21:59:27.741098Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-01-07T21:59:27.741221Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-01-07T21:59:27.810722Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2020-01-07T21:59:27.810737Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2020-01-07T21:59:27.811201Z 0 [Warning] CA certificate ca.pem is self signed.
2020-01-07T21:59:27.811224Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2020-01-07T21:59:27.811663Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2020-01-07T21:59:27.811680Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2020-01-07T21:59:27.811738Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2020-01-07T21:59:27.813580Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200107 21:59:27
2020-01-07T21:59:27.816611Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table storage engine for 'user' doesn't have this option
2020-01-07T21:59:27.816628Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
2020-01-07T21:59:27.816674Z 0 [ERROR] Aborting

2020-01-07T21:59:27.816694Z 0 [Note] Binlog end
2020-01-07T21:59:27.816756Z 0 [Note] Shutting down plugin 'ngram'
2020-01-07T21:59:27.816763Z 0 [Note] Shutting down plugin 'partition'
2020-01-07T21:59:27.816765Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2020-01-07T21:59:27.816767Z 0 [Note] Shutting down plugin 'ARCHIVE'
2020-01-07T21:59:27.816769Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2020-01-07T21:59:27.816803Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2020-01-07T21:59:27.816806Z 0 [Note] Shutting down plugin 'MyISAM'
2020-01-07T21:59:27.816811Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2020-01-07T21:59:27.816814Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2020-01-07T21:59:27.816816Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2020-01-07T21:59:27.816817Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2020-01-07T21:59:27.816819Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2020-01-07T21:59:27.816821Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2020-01-07T21:59:27.816822Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2020-01-07T21:59:27.816824Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2020-01-07T21:59:27.816826Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2020-01-07T21:59:27.816828Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2020-01-07T21:59:27.816829Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2020-01-07T21:59:27.816831Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2020-01-07T21:59:27.816833Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2020-01-07T21:59:27.816834Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2020-01-07T21:59:27.816836Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2020-01-07T21:59:27.816838Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2020-01-07T21:59:27.816839Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2020-01-07T21:59:27.816841Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2020-01-07T21:59:27.816843Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2020-01-07T21:59:27.816844Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2020-01-07T21:59:27.816846Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2020-01-07T21:59:27.816848Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2020-01-07T21:59:27.816849Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2020-01-07T21:59:27.816851Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2020-01-07T21:59:27.816852Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2020-01-07T21:59:27.816854Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2020-01-07T21:59:27.816856Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2020-01-07T21:59:27.816857Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2020-01-07T21:59:27.816859Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2020-01-07T21:59:27.816861Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2020-01-07T21:59:27.816863Z 0 [Note] Shutting down plugin 'InnoDB'
2020-01-07T21:59:27.816936Z 0 [Note] InnoDB: FTS optimize thread exiting.
2020-01-07T21:59:27.817047Z 0 [Note] InnoDB: Starting shutdown...
2020-01-07T21:59:27.922074Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2020-01-07T21:59:27.922231Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 200107 21:59:27
2020-01-07T21:59:29.468679Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2628265
2020-01-07T21:59:29.470792Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-01-07T21:59:29.470822Z 0 [Note] Shutting down plugin 'MEMORY'
2020-01-07T21:59:29.470827Z 0 [Note] Shutting down plugin 'CSV'
2020-01-07T21:59:29.470830Z 0 [Note] Shutting down plugin 'sha256_password'
2020-01-07T21:59:29.470832Z 0 [Note] Shutting down plugin 'mysql_native_password'
2020-01-07T21:59:29.470919Z 0 [Note] Shutting down plugin 'binlog'
2020-01-07T21:59:29.471136Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2020-01-07T21:59:29.582468Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

因此,有任何想法可以解释为什么我会遇到此问题,或者任何可以使我找到正确方法的提示。

最佳答案

创建Docker镜像时,它将生成一个初始数据库。

问题在于,当您尝试运行时,此位置中的文件随后将安装在覆盖文件系统上。

这些文件在mysql启动时不能使用,因为它们不能就地修改。

当您进行chown时,它会创建文件的"new"副本,这使得mysql可以启动,因为这些文件现在可以就地进行修改了。

如果您想要一个可以启动新的mysql的容器,那么最好的解决方法是删除/var/lib/mysql下的所有内容,作为镜像创建步骤的一部分。它将在第一次启动时重新创建数据库,从而可以根据需要使用它。

关于linux - MySQL将不会开始使用Dockerfile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59636347/

相关文章:

bash - 如何在 Bash 脚本中获取上个月的第一个和最后一个日期?

python - 如何防止 shell 在运行 python 脚本时获取输入(键盘)?

linux - cron 作业的两个参数 - 开始时间和结束时间应该涵盖一整天

shell - 具有单一身份验证的两个 scp 和 ssh 进程

python - 覆盖 ipython 退出函数 - 或者在其中添加 Hook

c - 这次相关流程会计统计数据收集是否合适?

c++ - Linux 共享库中缺少函数

c++ - 接收麦克风输入和处理

linux - "Not enough clusters for a 16 bit FAT",但我超过了最小尺寸。为什么?

bash - 错误陷阱用户输入-Bash脚本循环