Container-volumes Question


#1

Hi all,

I was just looking for some clarification on how the container-volumes option works.

I’m currently using Docker in Windows 10 and using linux containers. I would ideally like to make it so that a specified Windows folder (containing an rds dataset) will be available to the shiny app in the containers that are spun up.

I have the data in a folder “C:\Program Files\ShinyApps\myapp\data” and want it to be available to containers. I’ve tried using:

container-volumes: [ “C:/Program Files/ShinyApps/myapp/data”, “/root/myapp/data”]

and also

container-volumes: [ “C:/Program Files/ShinyApps/myapp/data”, “/root/appdata”]

along with various others.

and none have worked (I’ve changed the app coding to point to the correct directory each time, well at least I think the correct directory).

What is the proper way to specify this? Do I need to replace the white space with %20? Do I need to use something other than the color in “C:/…”?

Any help would be appreciated. Thanks!


#2

Hi @slacey,

The problem could be that you have a space in the path. Can you try to escape it with \ or use a different path without spaces?
There are also some windows-specific settings to allow sharing, that might need to be used: https://docs.docker.com/docker-for-windows/#shared-drives


#3

Thank you for the suggestion. I got it fixed. I wanted to post what worked for me if anyone in the future is having similar issues.

I saw in another thread to try bashing into the container to make sure that it is working. I got it working with the following:

docker run -p 3838:3838 -v C:/ShinyData/myapp:/mydata:ro myapp-1

I wasn’t able to get it working using Program Files so that definitely seemed to help moving it to a path without spaces.

Also, once I got it working in bash, I was able to figure out that there were several typos in my application.yml that were also preventing it from working. For example, I had rebuilt the image under the name myapp-1 instead of myapp_1 but never changed the application.yml specification.

Thank you again @mnazarov

EDIT: Oops just wanted to add my container-volume specification as well:

container-volumes: [ “C:/ShinyData/myapp:/mydata:ro” ]