Reputation: 2444
I think that my question is simple but I want to make sure I am taking the right approach. On my host computer, I have a path, e.g. /my/docs
, which contains HTML files which get updated automatically.
I have a Docker container with a small web server these html files. I would like to create a named coker volume to called my-docs
to point to /my/docs
, so that I can start the container as docker run -v my-docs:/public ...
Is this the right approach, and if so, what is the docker create volume
command?
Upvotes: 0
Views: 462
Reputation: 264901
The default "local" driver for named volumes places the data inside of the docker directories. The correct way to do what you want is to use the built in host volume, instead of a named volume:
docker run -v /my/docs:/public ...
Alternatively, you can first copy the contents from /my/docs into the named volume and then use that named volume:
docker run --rm \
-v /my/docs:/source -v my-docs:/target \
busybox cp -av /source/. /target/
docker run --rm -it -v my-docs:/public busybox /bin/sh
It's also possible that someone has created a driver for this, or for you to create one yourself. See the volume driver plugin docs for more details.
Upvotes: 1