【问题标题】:Dockerizing an app that uses mxnet package in R在 R 中对使用 mxnet 包的应用程序进行 Dockerizing
【发布时间】:2016-12-11 17:30:42
【问题描述】:

我正在对接一个使用“mxnet”包的闪亮应用程序。经过大量努力,我得出结论,我需要构建和安装软件包,而不是仅仅从 dmlc 存储库正常安装它。下面是我尝试构建和安装 mxnet 的简化 dockerfile:

FROM r-base:latest


RUN apt-get update && apt-get install -y \
sudo \
gdebi-core \
pandoc \
pandoc-citeproc \
libcurl4-gnutls-dev \
libcairo2-dev/unstable \
libxt-dev \
libssl-dev

# Download and install shiny server
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

# Here comes the installation of other required packages:
# .......



#*** Here comes the problamatic bit: building Installing mxnet
RUN sudo apt-get update
RUN sudo apt-get install -y build-essential git libatlas-base-dev libopencv-dev

RUN git clone --recursive https://github.com/dmlc/mxnet
RUN cd mxnet; make -j$(nproc)

RUN Rscript -e "install.packages('devtools', repo = 'https://cran.rstudio.com')"

RUN cd R-package

RUN Rscript -e "library('devtools'); library('methods'); options(repos=c(CRAN='https://cran.rstudio.com')); install_deps(dependencies = TRUE)"


RUN cd ..

RUN make rpkg


COPY shiny-server.conf  /etc/shiny-server/shiny-server.conf
COPY /myapp/* /srv/shiny-server/

EXPOSE 80

COPY shiny-server.sh /usr/bin/shiny-server.sh

CMD ["/usr/bin/shiny-server.sh"]

运行后,我收到一条错误消息:

can not cd to R-Package

有什么帮助吗?

【问题讨论】:

    标签: r docker shiny dockerfile mxnet


    【解决方案1】:

    试试

    RUN cd mxnet; make -j$(nproc)\ && Rscript -e "install.packages('devtools', repo = 'https://cran.rstudio.com')"

    你的RUN cd .. 不会做你所期望的,这就像打开一个终端,做cd abc/def 和在另一个终端,在/home/$USER 中,做cd ..,你不会在 abc 中。

    您应该对 RUN 命令进行分组以限制图像中的层数,请参阅

    https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/

    还要检查 Dockerfile 中的 WORKDIR 指令

    https://docs.docker.com/engine/reference/builder/#workdir

    你可以通过启动一个 shell 来检查什么是正确的(或没有)

    docker run -it your_image /bin/bash

    然后检查是否存在。

    【讨论】:

    • 你回答的第二部分真的很有帮助。当我使用“WORKDIR”时,我设法构建了它,但是加入两个运行命令并不是真正的问题。您可以相应地修改您的答案,以便我可以说谢谢并接受它;)
    猜你喜欢
    • 2016-07-13
    • 1970-01-01
    • 2019-06-08
    • 1970-01-01
    • 2020-05-27
    • 2017-09-25
    • 2018-08-22
    • 2018-12-24
    • 2019-06-29
    相关资源
    最近更新 更多