【问题标题】:How to create a docker image of an existing R Shiny app in windows?如何在 Windows 中创建现有 R Shiny 应用程序的 docker 映像?
【发布时间】:2019-10-05 00:23:36
【问题描述】:

R 闪亮应用程序的 docker 化过程是通过摇杆/闪亮图像完成的。我需要在 Windows 系统的 R 闪亮应用程序上运行 dockerization。唯一的问题是用于此过程的rocker/shiny 是基于Linux 的容器。因此,我无法生成在我的 Windows 系统上运行的图像。由于安全原因,我不能使用外部 VPS 或 VM。

我曾尝试编写一个可在 Windows 上运行的 docker 文件,但问题是容器是基于 Linux 的。

我的 Dockerfile

FROM rocker/r-ver:3.5.1 

#installing R libraries

RUN R -e "install.packages(c('shiny', 'shinydashboard'), repos='http://cran.us.r-project.org')"

# Copy configuration files into the Docker image
COPY shiny-server.conf  /etc/shiny-server/shiny-server.conf
COPY /app/srv/shiny-server/

# Make the ShinyApp available at port 80
EXPOSE 80

#Copy further configuration files into the Docker image
COPY shiny-server.sh /usr/bin/shiny-server.sh

CMD ['Rscript', 'app_run.R'] 
(original documentation mentions a .sh file which is not running on my system 
because of the Linux windows file path issues)

在那里运行 2 个命令后,我希望我闪亮的应用程序可以在 localhost:8080 上运行

Get-Content Dockerfile | docker build -

docker run --name DOCKERapp -p 8080:8080 <image_name>

【问题讨论】:

    标签: r windows docker shiny


    【解决方案1】:

    您的 dockerfile 中的基础是 rocker/r-ver:3.5.1,而此映像的基础是 debian。你可以在这里查看: https://hub.docker.com/r/rocker/r-ver/dockerfile

    所以在你的 dockerfile 中你需要使用 linux 命令。您不需要使用 windows 命令。

    【讨论】:

      猜你喜欢
      • 2017-05-27
      • 2021-01-24
      • 2014-06-10
      • 1970-01-01
      • 2020-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-21
      相关资源
      最近更新 更多