[英]Docker container not mounting data volume
I've got a locally maintained Docker image that, for some reason, is not mounting the local data volume in the container. 我有一个本地维护的Docker镜像,由于某种原因,它没有在容器中安装本地数据卷。
docker run -d -v /mnt/melissadata:/usr/local/tomcat/appconf -p 7070:7070 -p 80:8080 --restart on-failure:3 --name addrgeo imagename
On my local data volume, I have a number of files the service needs, but it's unable to find them. 在我的本地数据卷上,我有许多服务需要的文件,但它无法找到它们。
I know the volume is mounted. 我知道音量已经安装。
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvdi 202:128 0 10G 0 disk /mnt/melissadata
And it appears that the Docker container can see the volume... 看来Docker容器可以看到音量......
$ docker inspect
...
"Mounts": [
{
"Source": "/mnt/melissadata",
"Destination": "/usr/local/tomcat/appconf",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
}
],
findmnt
returns: findmnt
返回:
$ sudo findmnt -o TARGET,PROPAGATION /mnt/melissadata
TARGET PROPAGATION
/mnt/melissadata private
Any thoughts? 有什么想法吗?
The reason this was happening is because the Docker daemon uses devicemapper to devicemapper to back Docker's layer storage. 发生这种情况的原因是因为Docker守护程序使用devicemapper来devicemapper来支持Docker的图层存储。 If the volume was mounted after the Docker daemon was started, then Docker doesn't know it exists. 如果在Docker守护程序启动后安装了卷,则Docker不知道它存在。 A restart of the Docker daemon fixes it. 重启Docker守护进程会修复它。
sudo service docker restart
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.