Reputation: 97
I'm using rancher with only one host for test. When deploying a container, I'd need to have access the container persistent data from the host, to simplify my test. One option I see would be that I mount a local filesystem path to the container as /srv/myfolder:/etc/myfolder. I've already done that with Docker.
I've tried to do it from Rancher, but it does work. Do I need to do something specific?
The second option would be to have a docker volume. I've tried, and it works. But I don't know how I could access it from the docker host. Is there a way to do it or is it not possible by default?
Thank you
Fabrice
Upvotes: 0
Views: 2448
Reputation: 2053
I think it is related to this answer.
You can create a docker volume binded to local directory of your desire. Like this:
docker volume create -d local -o type=none -o o=bind \
-o device=/srv/myfolder container_etc_volume
Then you can use it like:
docker run -d -v container_etc_volume:/etc/myfolder .....
Then you can access it from host:
ls -la /srv/myfolder
Upvotes: 2