我在Mac上
10.11.3 (15D21)
关于
Docker
我有:
$ docker version
Client:
Version: 1.10.3
API version: 1.22
Go version: go1.5.3
Git commit: 20f81dd
Built: Thu Mar 10 21:49:11 2016
OS/Arch: darwin/amd64
Server:
Version: 1.10.3
API version: 1.22
Go version: go1.5.3
Git commit: 20f81dd
Built: Thu Mar 10 21:49:11 2016
OS/Arch: linux/amd64
使用以下Dockerfile(
Docker with mysql: The error means mysqld does not have the access rights to the directory
):
FROM mysql:latest
RUN deluser mysql
RUN useradd mysql
RUN mkdir -p /Users/me/docker/mysql/data
RUN chmod -R 777 /Users/me/docker/mysql/data
我创建了一个新图像
docker build -t localmysql:latest .
命名的
localmysql
REPOSITORY TAG IMAGE ID CREATED SIZE
localmysql latest ea0f7da32de8 15 hours ago 361.6 MB
我可以创建
manolitomysql
来自的新容器
本地mysql
新图像(为了更好地欣赏,我使用了多行):
docker run -v /Users/me/docker/mysql/data:/var/lib/mysql
--name manolitomysql
-e MYSQL_DATABASE='mysqldb' -e MYSQL_USER='mysql'
-e MYSQL_PASSWORD='mysql' -e MYSQL_ALLOW_EMPTY_PASSWORD='yes'
-e MYSQL_ROOT_PASSWORD='' -d localmysql
容器运行:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
06f15352aa7c localmysql "/entrypoint.sh mysql" 23 seconds ago Up 22 seconds 3306/tcp manolitomysql
即使我也可以用
docker exec -it manolitomysql /bin/bash
但超过30秒后,容器压碎了
#docker logs manolitomysql
Initializing database
2016-03-28T13:27:01.600230Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2016-03-28T13:27:03.355428Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-03-28T13:27:03.705206Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-03-28T13:27:03.765510Z 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: c2837bb5-f4e8-11e5-a856-0242ac110002.
2016-03-28T13:27:03.766641Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-03-28T13:27:03.767732Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2016-03-28T13:27:04.960541Z 1 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2016-03-28T13:27:04.960616Z 1 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2016-03-28T13:27:04.960716Z 1 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2016-03-28T13:27:04.960846Z 1 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2016-03-28T13:27:04.960962Z 1 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
Database initialized
MySQL init process in progress...
2016-03-28T13:27:07.059842Z 0 [Note] mysqld (mysqld 5.7.11) starting as process 38 ...
2016-03-28T13:27:07.062158Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2016-03-28T13:27:07.063330Z 0 [ERROR] Plugin keyring_file reported: 'keyring_file initialization failure. Please check if the keyring_file_data points to readable keyring file or keyring file can be created in the specified location. The keyring_file will stay unusable until correct path to the keyring file gets provided'
2016-03-28T13:27:07.063747Z 0 [Note] InnoDB: PUNCH HOLE support available
2016-03-28T13:27:07.063766Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-03-28T13:27:07.063776Z 0 [Note] InnoDB: Uses event mutexes
2016-03-28T13:27:07.063785Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-03-28T13:27:07.063794Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-03-28T13:27:07.063803Z 0 [Note] InnoDB: Using Linux native AIO
2016-03-28T13:27:07.063957Z 0 [Note] InnoDB: Number of pools: 1
2016-03-28T13:27:07.064037Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-03-28T13:27:07.069596Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-03-28T13:27:07.075441Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-03-28T13:27:07.076643Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2016-03-28T13:27:07.102198Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2016-03-28T13:27:07.133326Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2016-03-28T13:27:07.133809Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2016-03-28T13:27:07.185431Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2016-03-28T13:27:07.263862Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2016-03-28T13:27:07.263953Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2016-03-28T13:27:07.264530Z 0 [Note] InnoDB: Waiting for purge to start
2016-03-28T13:27:07.315152Z 0 [Note] InnoDB: 5.7.11 started; log sequence number 2492554
2016-03-28T13:27:07.315489Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-03-28T13:27:07.316620Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2016-03-28T13:27:07.326420Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2016-03-28T13:27:07.326507Z 0 [ERROR] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.
2016-03-28T13:27:07.326522Z 0 [ERROR] Unable to setup unix socket lock file.
2016-03-28T13:27:07.326531Z 0 [ERROR] Aborting
2016-03-28T13:27:07.326545Z 0 [Note] Binlog end
2016-03-28T13:27:07.326591Z 0 [Note] Shutting down plugin 'ngram'
2016-03-28T13:27:07.326605Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2016-03-28T13:27:07.326614Z 0 [Note] Shutting down plugin 'partition'
2016-03-28T13:27:07.326623Z 0 [Note] Shutting down plugin 'ARCHIVE'
2016-03-28T13:27:07.326632Z 0 [Note] Shutting down plugin 'MEMORY'
2016-03-28T13:27:07.326641Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2016-03-28T13:27:07.326650Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2016-03-28T13:27:07.326658Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2016-03-28T13:27:07.326673Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2016-03-28T13:27:07.326681Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2016-03-28T13:27:07.326690Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2016-03-28T13:27:07.326698Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2016-03-28T13:27:07.326706Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2016-03-28T13:27:07.326715Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2016-03-28T13:27:07.326723Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2016-03-28T13:27:07.326731Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2016-03-28T13:27:07.326740Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2016-03-28T13:27:07.326748Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2016-03-28T13:27:07.326757Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2016-03-28T13:27:07.326765Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2016-03-28T13:27:07.326773Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2016-03-28T13:27:07.326782Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2016-03-28T13:27:07.326790Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2016-03-28T13:27:07.326798Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2016-03-28T13:27:07.326807Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2016-03-28T13:27:07.326816Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2016-03-28T13:27:07.326824Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2016-03-28T13:27:07.326832Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2016-03-28T13:27:07.326841Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2016-03-28T13:27:07.326850Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2016-03-28T13:27:07.326858Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2016-03-28T13:27:07.326866Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2016-03-28T13:27:07.326875Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2016-03-28T13:27:07.326883Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2016-03-28T13:27:07.326894Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2016-03-28T13:27:07.326903Z 0 [Note] Shutting down plugin 'InnoDB'
2016-03-28T13:27:07.326970Z 0 [Note] InnoDB: FTS optimize thread exiting.
2016-03-28T13:27:07.327081Z 0 [Note] InnoDB: Starting shutdown...
2016-03-28T13:27:07.327112Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160328 13:27:07
2016-03-28T13:27:07.327946Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2016-03-28T13:27:07.328953Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 160328 13:27:07
MySQL init process in progress...
MySQL init process in progress...
2016-03-28T13:27:08.954395Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2492573
2016-03-28T13:27:08.956113Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2016-03-28T13:27:08.956170Z 0 [Note] Shutting down plugin 'MyISAM'
2016-03-28T13:27:08.956206Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2016-03-28T13:27:08.956221Z 0 [Note] Shutting down plugin 'CSV'
2016-03-28T13:27:08.956234Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2016-03-28T13:27:08.956293Z 0 [Note] Shutting down plugin 'sha256_password'
2016-03-28T13:27:08.956306Z 0 [Note] Shutting down plugin 'mysql_native_password'
2016-03-28T13:27:08.956317Z 0 [Note] Shutting down plugin 'keyring_file'
2016-03-28T13:27:08.956515Z 0 [Note] Shutting down plugin 'binlog'
2016-03-28T13:27:08.956853Z 0 [Note] mysqld: Shutdown complete
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process failed.
Manuels-MacBook-Pro:~ manueljordan$
在
错误
从上方:
一
[ERROR] Plugin keyring_file reported: 'keyring_file initialization failure. Please check if the keyring_file_data points to readable keyring file or keyring file can be created in the specified location. The keyring_file will stay unusable until correct path to the keyring file gets provided'
第二
[ERROR] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.
[ERROR] Unable to setup unix socket lock file.
[ERROR] Aborting
需要什么额外的配置?