鍍金池/ 問答/數(shù)據(jù)庫/ Mac 下使用 Docker mysql 運行的容器如果掛載了/var/lib/

Mac 下使用 Docker mysql 運行的容器如果掛載了/var/lib/mysql 不能啟動容器

image: https://hub.docker.com/_/mysql/

通過以下命令不能啟動容器:

docker run --name db -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d -p 3306:3306 -v /Users/user/Desktop/db/mysql/data:/var/lib/mysql -v /Users/user/Desktop/db/mysql/cnf:/etc/mysql/conf.d mysql

已經(jīng)更新了宿主機mysql目錄權(quán)限:

chmod -R 777 /Users/user/Desktop/db/mysql

PS: 如果只掛載conf.d則可以正常運行

Initializing database
2018-07-04T01:20:04.193456Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2018-07-04T01:20:04.193712Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.11) initializing of server in progress as process 26
2018-07-04T01:20:04.198022Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
mbind: Operation not permitted
2018-07-04T01:20:05.044093Z 1 [ERROR] [MY-012592] [InnoDB] InnoDB: Operating system error number 13 in a file operation.
2018-07-04T01:20:05.044352Z 1 [ERROR] [MY-012595] [InnoDB] InnoDB: The error means mysqld does not have the access rights to the directory.
2018-07-04T01:20:05.044409Z 1 [ERROR] [MY-000000] [InnoDB] InnoDB: Assertion failure: fil0fil.cc:2423:success
InnoDB: thread 140676164908800
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
01:20:05 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=0
max_threads=151
thread_count=1
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 67841 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x557113ffa7f0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7ff1b8d66e08 thread_stack 0x46000
/usr/sbin/mysqld(my_print_stacktrace(unsigned char*, unsigned long)+0x2e) [0x557111c20b1e]
/usr/sbin/mysqld(handle_fatal_signal+0x4c1) [0x557110f1b3c1]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x110c0) [0x7ff1bc1910c0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcf) [0x7ff1ba426fff]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7ff1ba42842a]
/usr/sbin/mysqld(+0xb16c81) [0x557110d0bc81]
/usr/sbin/mysqld(Fil_shard::open_file(fil_node_t*, bool)+0x2e5) [0x557111fb9805]
/usr/sbin/mysqld(Fil_shard::open_system_tablespaces(unsigned long, unsigned long*)+0x108) [0x557111fb9b58]
/usr/sbin/mysqld(Fil_system::open_all_system_tablespaces()+0x44) [0x557111fb9e84]
/usr/sbin/mysqld(+0x1c64893) [0x557111e59893]
/usr/sbin/mysqld(srv_start(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x168a) [0x557111e5f01a]
/usr/sbin/mysqld(+0x1b0d3ba) [0x557111d023ba]
/usr/sbin/mysqld(dd::bootstrap::DDSE_dict_init(THD*, dict_init_mode_t, unsigned int)+0x86) [0x557111bbbde6]
/usr/sbin/mysqld(dd::bootstrap::initialize(THD*)+0x7a) [0x557111bc240a]
/usr/sbin/mysqld(+0xdcdb03) [0x557110fc2b03]
/usr/sbin/mysqld(+0x1eb738f) [0x5571120ac38f]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7494) [0x7ff1bc187494]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7ff1ba4dcacf]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0): Connection ID (thread ID): 1
Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
回答
編輯回答
護她命

可能是Docker Toolbox的原因,換成Docker for Mac就好了。

2018年6月12日 13:40