0

我从 docker image 构建了奇异容器kfoltynski/shinyproxy-demo:singularity。当我跑

singularity run shiny.simg 3839

闪亮的应用程序可用localhost:3839,但在运行奇异容器作为实例之后

singularity instance start shiny.simg shiny 3839

它不是。为什么?

重现步骤:

Dockerfile

FROM openanalytics/r-base

MAINTAINER Tobias Verbeke "Tazovsky"

RUN apt-get update && apt-get install -y \
    sudo \
    pandoc \
    pandoc-citeproc \
    libcurl4-gnutls-dev \
    libcairo2-dev \
    libxt-dev \
    libssl-dev \
    libssh2-1-dev \
    libssl1.0.0

# packages needed for basic shiny functionality
RUN R -e "install.packages(c('shiny', 'rmarkdown'), repos='https://cloud.r-project.org')"

# install shinyproxy package with demo shiny application
COPY shinyproxy /shinyproxy
RUN R CMD INSTALL /shinyproxy
RUN rm /shinyproxy

# set host and port
COPY Rprofile.site /usr/lib/R/etc/

EXPOSE 3838

ENV PORT=3839

CMD ["R", "-e", "shinyproxy::run_01_hello(as.numeric(Sys.getenv(\"PORT\")))"]

奇点定义/配方文件Singularity.recipe

Bootstrap: docker

From: kfoltynski/shinyproxy-demo:singularity

%environment

    export PORT=3839

%runscript

    echo "Running Shiny app on port $*"

    exec R -e "shinyproxy::run_01_hello($@)"

构建奇点图像shiny.simg

 sudo singularity build shiny.simg Singularity.recipe

运行容器:

singularity run shiny.simg 3839 # app is available on port 3839

将容器作为实例运行:

singularity instance start shiny.simg shiny 3839 # app is not available on port 3839

为什么将奇异容器作为实例运行时应用程序不可用?

4

1 回答 1

0

singularity instance start shiny.simg shiny 3839正在创建并启动一个名为 的新实例3839,而不是将其作为参数传递给%runscript. 要获得您想要的响应,您需要运行:

singularity instance start shiny.simg shiny_instance
singularity run instance://shiny_instance 3839

%runscript启动实例时不会调用该块。如果您希望在实例启动时运行进程,则需要使用该%startscript指令,如此处的文档中所示

例如,

Bootstrap: docker

From: kfoltynski/shinyproxy-demo:singularity

%environment
    export PORT=3839

%runscript
    echo "Running Shiny app on port $*"
    exec R -e "shinyproxy::run_01_hello($@)"

%startscript
    exec R -e "shinyproxy::run_01_hello($@)"
于 2019-05-29T14:28:19.980 回答