[英]nfs volume mount to mysql docker container inside a ubuntu virtualbox fail
在我的评论中回答。 无法回答我自己的问题。 因此,评论中的答案。 ----------------------- * ------------------------
请帮助我解决我面临的nfs卷安装问题。
我从freenas服务器安装了nfs文件共享,并将其安装在主机linux(ubuntu 14.04服务器)上
mount -t nfs -o proto=tcp xxx.xxx.x.xxx:/mnt/freenas/nmedia /mnt/media
在linux主机上,我安装了oracle virtualbox(4.3),并从主机/mnt/media
(又是ubuntu 14.04服务器)安装了带有共享文件夹的linux virtualbox,其中安装了kodi-xbmc。 在此virtualbox上,我具有以下版本详细信息的docker:
root@kodixbmc:~# docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d
OS/Arch (server): linux/amd64
我已通过以下启动脚本将主机上的共享文件夹从主机安装到virtualbox中,并在/etc/rc.local
了输入:
#!/bin/bash
echo 'Mounting Share folder to /mnt/Share'
`sudo mount -t vboxsf -o uid=$UID,gid=root media /mnt/media`
我想通过以下运行命令运行指向/mnt/media/mysql
的mysql容器:
docker run -d --privileged --name=mysql -v /mnt/media/mysql/data:/var/lib/mysql -v /mnt/media/mysql/logs:/var/log/mysql mgmttools:443/phani/mysql:latest
当我尝试通过以下方式连接到终端时,mysql恶魔未启动
docker run -it --privileged --name=mysql -v /mnt/media/mysql/data:/var/lib/mysql -v /mnt/media/mysql/logs:/var/log/mysql mgmttools:443/phani/mysql:latest /bin/bash
然后使用/usr/bin/mysqld_safe
自己执行mysqld,它可以写入日志文件,下面是日志文件的内容
151006 11:02:19 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
151006 11:02:19 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
151006 11:02:19 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
151006 11:02:19 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
151006 11:02:19 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
151006 11:02:19 InnoDB: The InnoDB memory heap is disabled
151006 11:02:19 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151006 11:02:19 InnoDB: Compressed tables use zlib 1.2.8
151006 11:02:19 InnoDB: Using Linux native AIO
151006 11:02:19 InnoDB: Initializing buffer pool, size = 128.0M
151006 11:02:20 InnoDB: Completed initialization of buffer pool
151006 11:02:20 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.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
151006 11:02:20 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
任何与卷装载相关的问题的经验法则是同步文件服务器用户和在Docker容器中运行进程的关键用户的用户ID和组ID。 我可以通过将docker容器的mysql用户和mysql组的uid和gid与我的freenas用户的uid和gid同步来解决我的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.