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

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

docker机版本0.3.0

Virtualbox版本4.3.30

在virtualbox中默认boot2docker虚拟机,共享文件夹/ Users

我在/Users/tinnguyen/Development/Docker/containers/mysql创build了要创build容器的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 

真的很感激任何帮助! 谢谢。

默认情况下,它应该设置正确,工作,但你可能想检查VirtualBox上的文件夹共享设置。

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