Reputation: 48711
I'm creating a volume like this:
docker volume create php
and want to mount a single file /etc/php.ini
while running the container:
docker run -it -v php:/etc/php.ini image-name
This throws an error:
docker: Error response from daemon: readdirent: not a directory.
See 'docker run --help'.
Can I use volumes for this purpose or they are meant to handle directories only? What could be the solution here?
Upvotes: 3
Views: 961
Reputation: 1701
According to this answer:
when you create a named volume and run a service/container with docker run -v my_volume:/root/volume my_container, data is stored in /var/lib/docker/volumes/my_volume/_data
Following this affirmation, it is unpossible to create a named volume and mount it as a file inside a container.
Upvotes: 1