nfs卷安装到ubuntu virtualbox内的mysql docker容器失败 [英] nfs volume mount to mysql docker container inside a ubuntu virtualbox fail

查看:160
本文介绍了nfs卷安装到ubuntu virtualbox内的mysql docker容器失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的评论中得到答复.无法回答我自己的问题.因此,评论中的答案. ----------------------- * ----------------------- -

Answered in my comment. Not able to answer my own question. Hence the answer in comment. -----------------------*------------------------

请帮助我解决我面临的nfs卷安装问题.

Please help me with the nfs volume mount issue I am facing.

我有一个来自freenas服务器的nfs文件共享设置,我正在将其安装在主机linux(ubuntu 14.04服务器)上

I've a nfs file share set-up from freenas server, which I am mounting on a host linux (ubuntu 14.04 server)

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:

On the linux host, I've oracle virtualbox (4.3) installed and I've linux virtualbox with shared folder from host /mnt/media (ubuntu 14.04 server again) in which I've installed kodi-xbmc. On this virtualbox, I've docker with following version details:

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中进行了输入:

I've mounted the shared folder from host into the virtualbox through the following start-up script with entry in /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容器:

I wanted to run the mysql container pointing to the /mnt/media/mysql through the following run command:

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

当我尝试通过

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,它可以写入日志文件,下面是日志文件的内容

and then execute the mysqld myself using/usr/bin/mysqld_safe it is able to write into the log file and following is the content of the log file

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同步来解决我的问题.

Thumb rule for any volume mount related issues is to synchronize user and group ids of the file server user and the key user running the processes in the docker container. I am able to solve my problem by synchronizing the uid and gid of the mysql user and mysql group of my docker container with that of my freenas user.

这篇关于nfs卷安装到ubuntu virtualbox内的mysql docker容器失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆