I've got a locally maintained Docker image that, for some reason, is not mounting the local data volume in the container.
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 inspect
...
"Mounts": [
{
"Source": "/mnt/melissadata",
"Destination": "/usr/local/tomcat/appconf",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
}
],
findmnt
returns:
$ 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. If the volume was mounted after the Docker daemon was started, then Docker doesn't know it exists. A restart of the Docker daemon fixes it.
sudo service docker restart
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.