首頁  >  問答  >  主體

docker - 没有没有谁在MacOS+Toolbox下部署mysql并且成功挂载volume的?

我是在MacOS下用Docker Toolbox,部署mysql,并且挂载了一个volume到/var/lib/mysql,但是启动容器的时候,报错。感觉和volume的权限相关。
具体错误展现如下:

Installing MySQL system tables...2015-11-16 01:33:36 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25) starting as process 33 ...
2015-11-16 01:33:36 33 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-11-16 01:33:36 33 [Note] InnoDB: The InnoDB memory heap is disabled
2015-11-16 01:33:36 33 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-11-16 01:33:36 33 [Note] InnoDB: Memory barrier is not used
2015-11-16 01:33:36 33 [Note] InnoDB: Compressed tables use zlib 1.2.7
2015-11-16 01:33:36 33 [Note] InnoDB: Using Linux native AIO
2015-11-16 01:33:36 33 [Note] InnoDB: Using CPU crc32 instructions
2015-11-16 01:33:36 33 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-11-16 01:33:36 33 [Note] InnoDB: Completed initialization of buffer pool
2015-11-16 01:33:36 33 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2015-11-16 01:33:36 33 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2015-11-16 01:33:36 33 [Note] InnoDB: Database physically writes the file full: wait...
2015-11-16 01:33:36 33 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2015-11-16 01:33:37 33 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2015-11-16 01:33:38 7f1307465720  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2015-11-16 01:33:38 7f1307465720  InnoDB: Assertion failure in thread 139719703156512 in file fil0fil.cc line 875
InnoDB: Failing assertion: ret
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/5.6/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
01:33:38 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.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

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

Thread pointer: 0x0
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 = 0 thread_stack 0x40000
/usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x8c01ee]
/usr/sbin/mysqld(handle_fatal_signal+0x471)[0x699291]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xf0a0)[0x7f13070440a0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35)[0x7f1305ae1165]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x180)[0x7f1305ae43e0]
/usr/sbin/mysqld[0xa2bf8d]
/usr/sbin/mysqld[0xa2e942]
/usr/sbin/mysqld[0x5cfbd2]
/usr/sbin/mysqld[0x9905f8]
/usr/sbin/mysqld[0x8d3eb5]
/usr/sbin/mysqld(_Z24ha_initialize_handlertonP13st_plugin_int+0x48)[0x5f95b8]
/usr/sbin/mysqld[0x70f879]
/usr/sbin/mysqld(_Z11plugin_initPiPPci+0x7b0)[0x713160]
/usr/sbin/mysqld(_Z11mysqld_mainiPPc+0x7bd)[0x5f1cad]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7f1305acdead]
/usr/sbin/mysqld[0x5e755d]
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.
# mysql_install_db
Installing MySQL system tables...2015-11-16 01:33:58 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25) starting as process 49 ...
2015-11-16 01:33:58 49 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-11-16 01:33:58 49 [Note] InnoDB: The InnoDB memory heap is disabled
2015-11-16 01:33:58 49 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-11-16 01:33:58 49 [Note] InnoDB: Memory barrier is not used
2015-11-16 01:33:58 49 [Note] InnoDB: Compressed tables use zlib 1.2.7
2015-11-16 01:33:58 49 [Note] InnoDB: Using Linux native AIO
2015-11-16 01:33:58 49 [Note] InnoDB: Using CPU crc32 instructions
2015-11-16 01:33:58 49 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-11-16 01:33:58 49 [Note] InnoDB: Completed initialization of buffer pool
2015-11-16 01:33:58 49 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2015-11-16 01:33:58 49 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2015-11-16 01:33:58 49 [Note] InnoDB: Database physically writes the file full: wait...
2015-11-16 01:33:58 49 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2015-11-16 01:33:58 49 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2015-11-16 01:33:59 7f5914eab720  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2015-11-16 01:33:59 7f5914eab720  InnoDB: Assertion failure in thread 140020579743520 in file fil0fil.cc line 875
InnoDB: Failing assertion: ret
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/5.6/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
01:33:59 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.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

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

Thread pointer: 0x0
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 = 0 thread_stack 0x40000
/usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x8c01ee]
/usr/sbin/mysqld(handle_fatal_signal+0x471)[0x699291]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xf0a0)[0x7f5914a8a0a0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35)[0x7f5913527165]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x180)[0x7f591352a3e0]
/usr/sbin/mysqld[0xa2bf8d]
/usr/sbin/mysqld[0xa2e942]
/usr/sbin/mysqld[0x5cfbd2]
/usr/sbin/mysqld[0x9905f8]
/usr/sbin/mysqld[0x8d3eb5]
/usr/sbin/mysqld(_Z24ha_initialize_handlertonP13st_plugin_int+0x48)[0x5f95b8]
/usr/sbin/mysqld[0x70f879]
/usr/sbin/mysqld(_Z11plugin_initPiPPci+0x7b0)[0x713160]
/usr/sbin/mysqld(_Z11mysqld_mainiPPc+0x7bd)[0x5f1cad]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7f5913513ead]
/usr/sbin/mysqld[0x5e755d]
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.
巴扎黑巴扎黑2743 天前834

全部回覆(4)我來回復

  • 迷茫

    迷茫2017-04-17 14:20:38

    之前碰到這個問題,如果是windows上面掛載,是否是因為你沒有將磁碟mount到虛擬機裡面,如果已經mount過去了,需要注意的是權限是否配置正確,在Dockerfile檔案裡對相應的目錄用usermod指令修改檔案所屬群組或使用者權限。

    如果還有問題,歡迎與我聯繫,應該可以幫你解決!

    回覆
    0
  • 迷茫

    迷茫2017-04-17 14:20:38

    在Mac下的大部分開發的東西,我全部放到虛擬機器裡面去,然後用Mac的終端遠端連接虛擬機器。 nginx、mongodb、mysql、apache、docker等等等很多開發server都在虛擬機器裡面,Mac本來機會乾淨一點。這樣做感覺像是在操作一台VPS。

    回覆
    0
  • 怪我咯

    怪我咯2017-04-17 14:20:38

    http://www.cnblogs.com/yjmyzz/p/run-mysq...
    這篇貼文可以解決你的問題,多了一層Boot2Docker,容器使用的檔案是虛擬機的文件,權限不好改


    問題原因:
    這是評論比較完整的解答,觀點比較正確,供你參考吧
    @mikeys Boot2Docker creates a VirtualBox share of /Users on your Mac to /Users on the Linux host. This is what lets you share any folder under your Mac's /Users directory with a docker container, because the paths are the same.

    Really what it does is automatically mount a VirtualBox share named Users to /Users (under Linux), and it so happens that it creates a share called Users from your Mac's /Users.

    The problem is that these shares are owned by the docker user (uid 1000) on in the Linux host. This means that any container that needs to write to a shared folder on your Mac will to run needs to weed run shared folder on your Mac will run 1005 U .

    This is only a problem with Boot2Docker because it uses the virtual box sharing, which changes the uid of the share to the docker user and you can't change this easily from Linux.

    In Vagrant, I usually solved this by changing my Vagrant file to use different permissions for the virtual box share:

    config.vm.synced_folder ".", "/vagrant", :mount_options => ['dmode=777,fmode=666']
    Maybe you could do something like that inside of your Boot🎜>Maybe you could do something like that inside of your Boot2Docker image, I haven hike 't looked into it. I think you would make these changes to /etc/rc.d/automount-shares in the Linux VM

    One way I solved this was to just set my containers up so that I could configure them with the UID I wanted them to run their processes as, so I could just set it to 1000. The downside to this is that you basically need to create your own images for everything since most containers I've found don't let you do this.

    I hope this helps.

    回覆
    0
  • 怪我咯

    怪我咯2017-04-17 14:20:38

    不好意思,最近才看到,我實踐一下試試,希望可以幫你!

    回覆
    0
  • 取消回覆