Hi there,
For the reason that I’m going to explain below, I need to expose a container directory onto the same directory on the docker host; the reason being that the web service within the container is thus built that there are references to this path.
So far I’ve been able to do that with docker volume; i.e. docker volume create --opt type=none --opt device=/opt/prd/ui --opt o=bind --name www-root
When I run docker volume inspect www-root
, I get the following:
[
{
"Driver": "local",
"Labels": {},
"Mountpoint": "/var/lib/docker/volumes/www-root/_data",
"Name": "www-root",
"Options": {
"device": "/opt/prd/ui",
"o": "bind",
"type": "none"
},
"Scope": "local"
}
]
Afterwards, when I use that volume in a docker run
command, that works fine.
I am moving to docker swarm and I am using docker stack deploy
and docker compose file. If I put only the following for the volume in the yaml file:
volumes:
www-root:
and I inspect the created volume, that’s what I can find:
[
{
"Driver": "local",
"Labels": {
"com.docker.stack.namespace": "up-mdmksdev"
},
"Mountpoint": "/var/lib/docker/volumes/up-mdmksdev_www-root/_data",
"Name": "up-mdmksdev_www-root",
"Options": {},
"Scope": "local"
}
]
Indeed that’s not sufficient for my use case.
If, in the yaml file, I put the following:
volumes:
www-root:
options:
"device": "/opt/prd/ui"
"o": "bind"
docker stack deploy complains with the following:
options Additional property options is not allowed
Any idea how I should proceed ? For info, I’m using docker compose version: "3.2"