docker容器中的闪亮应用程序(叶viz)不加载浏览器

发布于 2025-02-11 20:03:41 字数 3541 浏览 0 评论 0原文

我正在构建一个码头容器来使用叶刀和叶间分析工具。从R文件命令的最终可视化使用使用Shiny应用程序,它在我的计算机上工作正常,但是当在容器中运行时,我无法连接到它。

我使用以下代码行运行容器:

docker run -dit --name leaf --rm -p 1234:1234 leafcutter

都是按序

CONTAINER ID   IMAGE        COMMAND   CREATED         STATUS         PORTS                                       NAMES
783f550df965   leafcutter   "bash"    2 minutes ago   Up 2 minutes   0.0.0.0:1234->1234/tcp, :::1234->1234/tcp   leaf

当我与Docker PS:在容器中执行管道调用几个snakefiles中的管道时,

Rscript /path/to/run_leafviz.R -i {input}

所有内容 在调用Leafviz()基本上仅运行Shiny应用程序之前,我已经修改了这样的选项:

shiny::runApp(launch.browser=FALSE, appDir = system.file("application", package = "leafviz"), host = "0.0.0.0", port = 1234)

所有闪亮的文件和软件包均安装在R Leafviz软件包中。当我执行所有容器时,输出都会显示“在 http://0.0.0.0.0.0.0.0:1234 /a>,但是当我尝试连接时,我会得到“连接失败”页面。

我的Dockerfile很大,但这里是最相关的部分:

FROM ubuntu:22.04
ENV DEBIAN_FRONTEND noninteractive

#Install Ubuntu packages
RUN apt-get update && apt-get install \
    -y cmake -y curl \
    -y default-jre \
    -y gdebi-core \
    -y less -y libarchive13 -y libbz2-dev -y libcairo2-dev -y libcurl4-openssl-dev -y libgsl-dev \
    -y liblzma-dev -y libncurses5-dev -y libncursesw5-dev -y libssl-dev -y libxml2-dev -y libxt-dev \
    -y pandoc -y pandoc-citeproc -y python-pip \
    -y tabix \
    -y unzip \
    -y wget \
    -y zlib1g-dev \
    && rm -rf /var/lib/apt/lists/*

#Install conda, snakemake, samtools, regtools...
#[...]

#Install R
LABEL org.label-schema.license="GPL-2.0" \
      org.label-schema.vcs-url="https://github.com/rocker-org/r-apt" \
      org.label-schema.vendor="Rocker Project" \
      maintainer="Dirk Eddelbuettel <[email protected]>"
RUN useradd docker \
    && mkdir /home/docker \
    && chown docker:docker /home/docker \
    && addgroup docker staff
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    littler r-base r-base-dev r-recommended r-cran-docopt
RUN ln -s /usr/lib/R/site-library/littler/examples/install.r /usr/local/bin/install.r \
    && ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \
    && ln -s /usr/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
    && ln -s /usr/lib/R/site-library/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
    && rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
    && rm -rf /var/lib/apt/lists/*

#Install shiny server (I have tried with and without this RUN command)
RUN wget --no-verbose https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/VERSION -O "version.txt" && \
    VERSION=$(cat version.txt)  && \
    wget --no-verbose "https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/shiny-server-$VERSION-amd64.deb" -O ss-latest.deb && \
    gdebi -n ss-latest.deb && \
    rm -f version.txt ss-latest.deb

EXPOSE 1234

#Install R packages
COPY install_packages.R /tmp/install_packages.R 
RUN Rscript /tmp/install_packages.R 

CMD ["bash"]

我一直在学习Docker,所以我不知道某些元素是否在发生冲突,但是我已经公开了容器端口并将其发布给主机,没有错误消息似乎表明还有一个来自其他地方的问题。我真的很感谢您的帮助。

I am building a docker container to use the Leafcutter and Leafviz analysis tools. The final visualization commanded from an R file uses shiny app, it works fine on my machine but when ran in the container I can't connect to it.

I run the container with the following line of code:

docker run -dit --name leaf --rm -p 1234:1234 leafcutter

All is in order when I check with docker ps:

CONTAINER ID   IMAGE        COMMAND   CREATED         STATUS         PORTS                                       NAMES
783f550df965   leafcutter   "bash"    2 minutes ago   Up 2 minutes   0.0.0.0:1234->1234/tcp, :::1234->1234/tcp   leaf

Executing the pipeline in the container calls several snakefiles, and the last rule of the last one calls the R file:

Rscript /path/to/run_leafviz.R -i {input}

That script calls several functions before calling leafviz() which basically just runs the shiny app, I've modified the options like so:

shiny::runApp(launch.browser=FALSE, appDir = system.file("application", package = "leafviz"), host = "0.0.0.0", port = 1234)

All the shiny files and packages are installed with the R leafviz package. When I execute my container all goes fine, the output shows "Listening on http://0.0.0.0:1234", but when I try to connect I get the "connexion failed" page.

My Dockerfile is fairly large but here are the most relevant parts:

FROM ubuntu:22.04
ENV DEBIAN_FRONTEND noninteractive

#Install Ubuntu packages
RUN apt-get update && apt-get install \
    -y cmake -y curl \
    -y default-jre \
    -y gdebi-core \
    -y less -y libarchive13 -y libbz2-dev -y libcairo2-dev -y libcurl4-openssl-dev -y libgsl-dev \
    -y liblzma-dev -y libncurses5-dev -y libncursesw5-dev -y libssl-dev -y libxml2-dev -y libxt-dev \
    -y pandoc -y pandoc-citeproc -y python-pip \
    -y tabix \
    -y unzip \
    -y wget \
    -y zlib1g-dev \
    && rm -rf /var/lib/apt/lists/*

#Install conda, snakemake, samtools, regtools...
#[...]

#Install R
LABEL org.label-schema.license="GPL-2.0" \
      org.label-schema.vcs-url="https://github.com/rocker-org/r-apt" \
      org.label-schema.vendor="Rocker Project" \
      maintainer="Dirk Eddelbuettel <[email protected]>"
RUN useradd docker \
    && mkdir /home/docker \
    && chown docker:docker /home/docker \
    && addgroup docker staff
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    littler r-base r-base-dev r-recommended r-cran-docopt
RUN ln -s /usr/lib/R/site-library/littler/examples/install.r /usr/local/bin/install.r \
    && ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \
    && ln -s /usr/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
    && ln -s /usr/lib/R/site-library/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
    && rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
    && rm -rf /var/lib/apt/lists/*

#Install shiny server (I have tried with and without this RUN command)
RUN wget --no-verbose https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/VERSION -O "version.txt" && \
    VERSION=$(cat version.txt)  && \
    wget --no-verbose "https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/shiny-server-$VERSION-amd64.deb" -O ss-latest.deb && \
    gdebi -n ss-latest.deb && \
    rm -f version.txt ss-latest.deb

EXPOSE 1234

#Install R packages
COPY install_packages.R /tmp/install_packages.R 
RUN Rscript /tmp/install_packages.R 

CMD ["bash"]

I've been learning docker quite chaotically so I don't know if some elements are clashing, but I have exposed the container port and published it to the host and no error message seems to indicate there is a problem coming from somewhere else. I would really appreciate some help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文