I have a single file which I want to mount in the container. The file is present in conf
folder which also contains other file but the file I only want to mount is helper.conf
. Doing this in docker:
docker run -it -v /path/to/dir/:/path/inside/container --name mycontainer dockerimage
Doing this throws below error:
Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
To resolve this, I created another folder with name config
inside conf
and used below line:
docker run -it -v /path/to/dir/config:/path/inside/container --name mycontainer dockerimage
This works perfectly fine. Same is happening with kubernetes
. Is it not possible to just mount a single file from a directory where other files are also present. Am I using wrong keywords for this.?
How can I resolve in Kubernetes?