使用带有虚拟框共享文件夹的docker机器启动mysql容器

时间:2015-07-25 21:57:23

标签: mysql docker virtualbox docker-machine

我尝试使用Docker Machine创建本地开发设置。我在尝试创建一个mysql容器时一直遇到错误。这是我的设置。

docker-machine version 0.3.0

Virtualbox版本4.3.30

虚拟机中的默认boot2docker vm,共享文件夹/用户

我创建了要在/Users/tinnguyen/Development/Docker/containers/mysql

创建容器时挂载的mysql文件夹

标准许可:

drwxr-xr-x 2 tinnguyen staff 68 Jul 25 16:45 mysql

下面是我的docker命令

docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=root -v /Users/tinnguyen/Development/Docker/containers/mysql:/var/lib/mysql mysql

当我docker logs mysql时,这就是我得到的错误

docker logs mysql
Running mysql_install_db
2015-07-25 21:45:45 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25) starting as process 29 ...
2015-07-25 21:45:45 29 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-07-25 21:45:45 29 [Note] InnoDB: The InnoDB memory heap is disabled
2015-07-25 21:45:45 29 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-07-25 21:45:45 29 [Note] InnoDB: Memory barrier is not used
2015-07-25 21:45:45 29 [Note] InnoDB: Compressed tables use zlib 1.2.7
2015-07-25 21:45:45 29 [Note] InnoDB: Using Linux native AIO
2015-07-25 21:45:45 29 [Note] InnoDB: Not using CPU crc32 instructions
2015-07-25 21:45:45 29 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-07-25 21:45:45 29 [Note] InnoDB: Completed initialization of buffer pool
2015-07-25 21:45:45 7f8c9b939720  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-07-25 21:45:45 7f8c9b939720  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-07-25 21:45:45 29 [ERROR] InnoDB: Creating or opening ./ibdata1 failed!
2015-07-25 21:45:45 29 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2015-07-25 21:45:45 29 [ERROR] Plugin 'InnoDB' init function returned error.
2015-07-25 21:45:45 29 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2015-07-25 21:45:45 29 [ERROR] Unknown/unsupported storage engine: InnoDB
2015-07-25 21:45:45 29 [ERROR] Aborting

2015-07-25 21:45:45 29 [Note] Binlog end
2015-07-25 21:45:45 29 [Note] /usr/sbin/mysqld: Shutdown complete

非常感谢任何帮助!感谢。

1 个答案:

答案 0 :(得分:0)

默认情况下,它应该正确设置并运行,但您可能需要检查VirtualBox上的文件夹共享设置。

运行VirtualBox,检查默认机器设置。单击“共享文件夹”并验证主机macbook中的/ Users文件夹是否已安装在VM中。