停靠flexdashboard应用程序赢得';不能在本地主机上运行
我正在尝试创建停靠的Flexdashboard应用程序。我可以在本地运行它,但不能在本地主机上运行。 但是,我可以在同一个docker映像中运行闪亮的应用程序。有趣的是,本地主机中的错误消息显示Flexdashboard应用程序的“未找到”,这与页面根本不存在(“未找到页面”)时不同 如何对Flexdashboard应用程序进行Dockerize? MWE Docker代码(在Powershell中运行) 本地主机URL停靠flexdashboard应用程序赢得';不能在本地主机上运行,r,docker,shiny,flexdashboard,R,Docker,Shiny,Flexdashboard,我正在尝试创建停靠的Flexdashboard应用程序。我可以在本地运行它,但不能在本地主机上运行。 但是,我可以在同一个docker映像中运行闪亮的应用程序。有趣的是,本地主机中的错误消息显示Flexdashboard应用程序的“未找到”,这与页面根本不存在(“未找到页面”)时不同 如何对Flexdashboard应用程序进行Dockerize? MWE Docker代码(在Powershell中运行) 本地主机URL (工程) (“未找到”错误) (“未找到页面”错误) 闪亮的应用程序运
- (工程)
- (“未找到”错误)
- (“未找到页面”错误)
这可能是您的映像中使用的rmarkdown包(rmarkdown v.1.18)中的错误导致的,并且与此相关:和。我猜这确实管用 下面是您如何测试这一点的方法。在apps文件夹中制作一个闪亮的应用程序,以查看正在运行的rmarkdown版本。在应用程序中创建一个名为“rmarkdown”的文件夹。然后将以下简单的ui.R和server.R脚本放入其中,以构建一个闪亮的应用程序(我们知道闪亮的应用程序为您呈现),以确定您拥有的rmarkdown版本: R脚本 server.r脚本
嗯,我运行了你的确切代码,可以看到
http://localhost:3838/kmeansflex
app.谢谢@Tylerlinker-我真的被这个难住了。我怀疑这是我个人电脑上的设置问题,希望有人对此有经验。
dir.create("testshinydocker")
dir.create("testshinydocker/apps")
dir.create("testshinydocker/apps/kmeans")
dir.create("testshinydocker/apps/kmeansflex")
cat(readLines("https://raw.githubusercontent.com/rstudio/shiny-examples/master/050-kmeans-example/server.R"),
file = "testshinydocker/apps/kmeans/server.R", sep = "\n")
cat(readLines("https://raw.githubusercontent.com/rstudio/shiny-examples/master/050-kmeans-example/ui.R"),
file = "testshinydocker/apps/kmeans/ui.R", sep = "\n")
cat(
c('FROM rocker/shiny:latest\n',
"RUN echo 'install.packages(c(\"flexdashboard\"), \\",
"repos='$MRAN', \\",
"dependencies=TRUE)' > /tmp/packages.R \\",
" && Rscript /tmp/packages.R\n",
'EXPOSE 3838\n',
'COPY apps /srv/shiny-server/\n',
'CMD ["/usr/bin/shiny-server.sh"]\n'),
file = "testshinydocker/Dockerfile",
sep = "\n"
)
cat(readLines("https://raw.githubusercontent.com/rstudio/flexdashboard/master/examples/11_shiny-kmeans-clustering/dashboard.Rmd"),
file = "testshinydocker/apps/kmeansflex/kmeans2.Rmd", sep = "\n")
shiny::runApp('testshinydocker/apps/kmeans')
rmarkdown::run("testshinydocker/apps/kmeansflex/kmeans2.Rmd")
cd {path to testshinydocker directory}
docker build -t myapp .
docker run --rm -d -p 3838:3838 myapp
fluidPage(
hr(),
fluidRow(column(3, verbatimTextOutput("value")))
)
function(input, output) {
output$value <- renderPrint({ utils::packageVersion('rmarkdown') })
}
FROM rocker/shiny:latest
# apt-get and system utilities
RUN apt-get update && apt-get install -y \
libssl-dev \
libsodium-dev
RUN echo 'install.packages(c("flexdashboard", "remotes", "openssl"), \
repos='$MRAN', \
dependencies=TRUE)' > /tmp/packages.R \
&& Rscript /tmp/packages.R
RUN Rscript -e 'remotes::install_github("rstudio/rmarkdown")'
COPY apps /srv/shiny-server/
EXPOSE 3838
CMD ["/usr/bin/shiny-server.sh"]