docker创建新映像无法启动mysql服务

pqwbnv8z  于 2021-06-15  发布在  Mysql
关注(0)|答案(4)|浏览(502)

我试着在ubuntu18.10上制作一个lamp的图像。
但我使用mysql服务时出现了一个错误。


* Starting MySQL database server mysqld

[fail]

这是我的文件


# LAMP Server on Ubuntu 18.04

FROM ubuntu:18.10

MAINTAINER Chess

# install LAMP

RUN apt update && \
    apt install -y \
        #apache2 \
        mysql-server \
        #php7.2 \
        #libapache2-mod-php7.2 \
        #php7.2-mysql \
    && rm -rf /var/lib/apt/lists/*

CMD service mysql start

一开始,我 apt install 所有的东西和检查它可以工作。这是官方形象 ubuntu:18.10 .
然后我用 commit 建立一个新的形象和使用新的 docker run 一个容器。
现在,我试着 service mysql restart ,但没用。。。
第二次,我用 Dockerfile 树立新形象 docker run 但这和第一次一样。
我发现了创建新图像时发生的错误。
如果我使用官方版本运行一个容器 apt install ,它会起作用的。
但我想为自己建立一个自定义的形象。
这次我该怎么办…我不知道怎么解决这个问题。

k10s72fa

k10s72fa2#

Version: '5.7.24-0ubuntu0.18.10.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
2018-12-15T08:31:39.238170Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2018-12-15T08:31:39.265443Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2018-12-15T08:31:39.428987Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-12-15T08:31:39.430105Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.24-0ubuntu0.18.10.1) starting as process 448 ...
2018-12-15T08:31:39.432695Z 0 [Note] InnoDB: PUNCH HOLE support available
2018-12-15T08:31:39.432725Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-12-15T08:31:39.432737Z 0 [Note] InnoDB: Uses event mutexes
2018-12-15T08:31:39.432747Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-12-15T08:31:39.432757Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2018-12-15T08:31:39.432766Z 0 [Note] InnoDB: Using Linux native AIO
2018-12-15T08:31:39.432911Z 0 [Note] InnoDB: Number of pools: 1
2018-12-15T08:31:39.432988Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-12-15T08:31:39.434050Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-12-15T08:31:39.439174Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-12-15T08:31:39.440474Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-12-15T08:31:39.564840Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-12-15T08:31:39.565766Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 2592124
2018-12-15T08:31:39.565796Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 2592133
2018-12-15T08:31:39.565809Z 0 [Note] InnoDB: Database was not shutdown normally!
2018-12-15T08:31:39.565818Z 0 [Note] InnoDB: Starting crash recovery.
2018-12-15T08:31:39.671659Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-12-15T08:31:39.671699Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-12-15T08:31:39.671759Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-12-15T08:31:39.686244Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-12-15T08:31:39.686754Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-12-15T08:31:39.686776Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-12-15T08:31:39.687002Z 0 [Note] InnoDB: Waiting for purge to start
2018-12-15T08:31:39.737229Z 0 [Note] InnoDB: 5.7.24 started; log sequence number 2592133
2018-12-15T08:31:39.737396Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2018-12-15T08:31:39.737459Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-12-15T08:31:39.777817Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2018-12-15T08:31:39.777855Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2018-12-15T08:31:39.777877Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2018-12-15T08:31:39.777897Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2018-12-15T08:31:39.782186Z 0 [Note] InnoDB: Buffer pool(s) load completed at 181215  8:31:39
2018-12-15T08:31:39.783534Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table storage engine for 'user' doesn't have this option
2018-12-15T08:31:39.783605Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
2018-12-15T08:31:39.783681Z 0 [ERROR] Aborting

2018-12-15T08:31:39.783714Z 0 [Note] Binlog end
2018-12-15T08:31:39.783810Z 0 [Note] Shutting down plugin 'auth_socket'
2018-12-15T08:31:39.783834Z 0 [Note] Shutting down plugin 'ngram'
2018-12-15T08:31:39.783844Z 0 [Note] Shutting down plugin 'partition'
2018-12-15T08:31:39.783853Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2018-12-15T08:31:39.783862Z 0 [Note] Shutting down plugin 'ARCHIVE'
2018-12-15T08:31:39.783870Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2018-12-15T08:31:39.783911Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2018-12-15T08:31:39.783921Z 0 [Note] Shutting down plugin 'MyISAM'
2018-12-15T08:31:39.783931Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2018-12-15T08:31:39.783941Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2018-12-15T08:31:39.783949Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2018-12-15T08:31:39.783957Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2018-12-15T08:31:39.783966Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2018-12-15T08:31:39.783974Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2018-12-15T08:31:39.783982Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2018-12-15T08:31:39.783990Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2018-12-15T08:31:39.783999Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2018-12-15T08:31:39.784008Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2018-12-15T08:31:39.784017Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2018-12-15T08:31:39.784025Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2018-12-15T08:31:39.784033Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2018-12-15T08:31:39.784041Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2018-12-15T08:31:39.784049Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2018-12-15T08:31:39.784057Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2018-12-15T08:31:39.784065Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2018-12-15T08:31:39.784078Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2018-12-15T08:31:39.784087Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2018-12-15T08:31:39.784095Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2018-12-15T08:31:39.784103Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2018-12-15T08:31:39.784112Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2018-12-15T08:31:39.784120Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2018-12-15T08:31:39.784128Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2018-12-15T08:31:39.784136Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2018-12-15T08:31:39.784144Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2018-12-15T08:31:39.784152Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2018-12-15T08:31:39.784161Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2018-12-15T08:31:39.784169Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2018-12-15T08:31:39.784177Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2018-12-15T08:31:39.784186Z 0 [Note] Shutting down plugin 'InnoDB'
2018-12-15T08:31:39.784265Z 0 [Note] InnoDB: FTS optimize thread exiting.
2018-12-15T08:31:39.784376Z 0 [Note] InnoDB: Starting shutdown...
2018-12-15T08:31:39.884650Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2018-12-15T08:31:39.884799Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 181215  8:31:39
2018-12-15T08:31:41.595133Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2592152
2018-12-15T08:31:41.597424Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-12-15T08:31:41.597466Z 0 [Note] Shutting down plugin 'MEMORY'
2018-12-15T08:31:41.597487Z 0 [Note] Shutting down plugin 'CSV'
2018-12-15T08:31:41.597498Z 0 [Note] Shutting down plugin 'sha256_password'
2018-12-15T08:31:41.597508Z 0 [Note] Shutting down plugin 'mysql_native_password'
2018-12-15T08:31:41.597627Z 0 [Note] Shutting down plugin 'binlog'
2018-12-15T08:31:41.597911Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2018-12-15T08:31:41.693253Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
hfwmuf9z

hfwmuf9z3#

/变量/库/

drwxr-xr-x 1 root  root  4096 Dec 15 08:28 .
drwxr-xr-x 1 root  root  4096 Nov 14 23:02 ..
drwxr-xr-x 1 root  root  4096 Dec 15 08:28 apt
drwxr-xr-x 1 root  root  4096 Dec 15 08:28 dpkg
drwxr-xr-x 2 root  root  4096 Oct 15 17:10 misc
drwx------ 1 mysql mysql 4096 Dec 15 08:31 mysql
drwx------ 2 mysql mysql 4096 Dec 15 08:28 mysql-files
drwx------ 2 mysql mysql 4096 Dec 15 08:28 mysql-keyring
drwxr-xr-x 2 root  root  4096 Oct 22 19:25 mysql-upgrade
drwxr-xr-x 2 root  root  4096 Nov 14 23:01 pam
drwxr-xr-x 1 root  root  4096 Nov 14 22:59 systemd

/var/lib/mysql/

drwx------ 1 mysql mysql     4096 Dec 15 08:31 .
drwxr-xr-x 1 root  root      4096 Dec 15 08:28 ..
-rw-r----- 1 mysql mysql       56 Dec 15 08:28 auto.cnf
-rw-r--r-- 1 root  root         0 Dec 15 08:28 debian-5.7.flag
-rw-r----- 1 mysql mysql      291 Dec 15 08:31 ib_buffer_pool
-rw-r----- 1 mysql mysql 50331648 Dec 15 08:31 ib_logfile0
-rw-r----- 1 mysql mysql 50331648 Dec 15 08:28 ib_logfile1
-rw-r----- 1 mysql mysql 12582912 Dec 15 08:31 ibdata1
drwxr-x--- 1 mysql mysql     4096 Dec 15 08:28 mysql
drwxr-x--- 2 mysql mysql     4096 Dec 15 08:28 performance_schema
drwxr-x--- 1 mysql mysql     4096 Dec 15 08:28 sys

相关问题