我创建了一个 Docker 映像(R-Shiny)并在我的 PC(Windows10)上通过 localhost 对其进行了测试。一切都很好。
但是一旦我在我的服务器(Ubuntu)上加载并托管我的 Docker 映像(通过 Shinyproxy 和 nginx),我就会收到错误消息
"Error
Status code: 500
Message: Container did not respond in time".
Docker 映像在 PC 上运行但不能通过服务器的公共 IP 运行的原因可能是什么?
Shinyproxy“示例应用程序”运行良好。您可以在 foundyoung.de 上自己测试。请记住,这只是一个测试环境。;)
谢谢和亲切的问候
添加了一些细节:
Dockerfile:
FROM rocker/r-base:latest
LABEL maintainer="USER <user@example.com>"
RUN apt-get update && apt-get install -y --no-install-recommends \
sudo \
libcurl4-gnutls-dev \
libgtk2.0-dev\
libjq-dev\
xvfb\
xauth\
xfonts-base\
libcairo2-dev \
libxt-dev \
libssl-dev \
libssh2-1-dev \
libxml2-dev \
libmagick++-dev\
openjdk-8-jre-headless\
openjdk-8-jdk\
&& R CMD javareconf\
&& rm -rf /var/lib/apt/lists/*
RUN sed -i 's/name="disk" value="1GiB"/name="disk" value="8GiB"/' /etc/ImageMagick-6/policy.xml
#r-cran-rjava\
RUN install.r shiny
RUN echo "local(options(shiny.port = 3838, shiny.host = '0.0.0.0'))" > /usr/lib/R/etc/Rprofile.site
RUN addgroup --system app \
&& adduser --system --ingroup app app
WORKDIR /home/app
COPY app .
RUN Rscript installPackages.R
RUN chown app:app -R /home/app
USER app
EXPOSE 3838
CMD ["R", "-e", "shiny::runApp('/home/app')"]
应用程序.yml
proxy:
title: ShinyProxy
# logo-url: https://link/to/your/logo.png
landing-page: /
favicon-path: favicon.ico
heartbeat-rate: 10000
heartbeat-timeout: 600000
port: 8080
# Example: 'simple' authentication configuration
# Docker configuration
docker:
cert-path: /home/none
url: http://localhost:2375
port-range-start: 20000
specs:
- id: 01_hello
display-name: Hello Shiny App
description: A simple reactive histogram
container-cmd: ["R", "-e", "shiny::runApp('/home/app')"]
container-image: registry.gitlab.com/analythium/shinyproxy-hello/hello:latest
logo-url: https://github.com/analythium/shinyproxy-1-click/raw/master/digitalocean/images/app-hist.png
- id: 02_hello
display-name: Demo Shiny App
description: App with sliders and large file upload
container-cmd: ["R", "-e", "shiny::runApp('/home/app')"]
container-image: 2007199809022014/container1:container1
logo-url: https://github.com/analythium/shinyproxy-1-click/raw/master/digitalocean/images/app-dots.png
logging:
file:
name: shinyproxy.log
spring:
servlet:
multipart:
max-file-size: 200MB
在 Ubuntu 20.04 上运行的服务器 我的 PC(Docker 映像运行良好):Windows10,通过 localhost:4000 进行 docker 测试) Docker 版本:20.10.7 开放端口:22、80、443、9000、80、8080、4000
如果你还需要什么,尽管问!