当运行ShinyProxy中包含的应用程序时,在本地访问文件

时间:2019-06-21 14:44:48

标签: docker shinyproxy

我有一个带有两个应用程序的Shinyproxy服务器。其中一个应用程序具有以下代码来访问文件:

you will still need to add an  /etc/hosts file entry for homestead.test or the domain of your choice if you are not using automatic 

但是,此映射在客户端不起作用。此应用程序已在Docker中进行了容器化,当我单击file.selected按钮时,我只能看到docker内部的文件。有什么办法可以在客户端查看文件吗?

例如,我是在计算机上键入服务器地址xx:xx:xx:xx:8080来访问我的应用程序的用户。加载后,有什么方法可以在我的计算机上(本地)查看文件?

我知道使用/etc/hosts可以使用浏览器文件列表功能,但是我还需要文件的完整路径,据我所知192.168.10.10 homestead.test 仅存储临时volumes = getVolumes() volumes <- c(Home = fs::path_home(), "R Installation" = R.home(), getVolumes()()) file_selected <- reactive({ shinyFileChoose(input, "file", roots = volumes, session = session) req(input$file) if (is.null(input$file)) return(NULL) #print(parseFilePaths(volumes, input$file)$datapath) return(parseFilePaths(volumes, input$file)$datapath) })

谢谢

1 个答案:

答案 0 :(得分:0)

您只能看到docker内部的文件,因为docker容器对主机文件系统一无所知。您应该在运行docker应用时共享音量。

使用-v标签以批量共享方式运行。

假设您需要访问主机的桌面文件夹。您应该像这样在Docker容器中使该文件夹可用:

docker run -d -p ExtPORThere:IntPORThere -v yourDesktopPath:aPATHinContainer YOURimageHere