r-从特定的docker图像运行Rstudio



问题:如何从特定的docker映像本地运行rstudio?


我知道rocker提供了一个可以用作docker run -e PASSWORD=yourpassword --rm -p 8787:8787 rocker/rstudio的图像,但我希望能够将此功能与自定义图像一起使用。

我有以下内容,很抱歉,如果这可以进一步减少-我不想失去任何重要的上下文:

from rocker/r-bspm:20.04
RUN apt update -qq 
# setup C++ Bits needed for working with Stan stuff.
RUN add-apt-repository -y ppa:marutter/rrutter4.0
RUN add-apt-repository -y ppa:c2d4u.team/c2d4u4.0+
RUN apt-get update
# Install rstan.
RUN install.r rstan
# Need this in order to install specific versions of R packages.
RUN R -e 'install.packages("remotes")'
# I'm following the outlines here for the following: 
# https://github.com/rmcelreath/rethinking/#installation
RUN R -e 'install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))'
RUN R -e "cmdstanr::install_cmdstan()"
# Install rethinking package.
RUN R -e 'install.packages(c("coda","mvtnorm","devtools","loo","dagitty","shape"))'
RUN R -e 'devtools::install_github("rmcelreath/rethinking")'
# Install Rstudio - From here is what I've added to the image in order to 
# try and use Rstudio from this image.
RUN apt -y install r-base gdebi-core
RUN wget https://download1.rstudio.org/desktop/bionic/amd64/rstudio-2021.09.2-382-amd64.deb
RUN gdebi -n rstudio-2021.09.2-382-amd64.deb

使用构建此图像后

docker build -f Dockerfile -t r_stat .

我试图将rocker命令复制如下:

docker run -e PASSWORD=password --rm -p 8787:8787 r_stat

不过,这似乎没有任何作用,在浏览器中转到localhost:8787也没有带来任何结果。

FROM rocker/r-bspm:20.04
RUN apt update -qq 
# setup C++ Bits needed for working with Stan stuff.
RUN add-apt-repository -y ppa:marutter/rrutter4.0
RUN add-apt-repository -y ppa:c2d4u.team/c2d4u4.0+
RUN apt-get update
# Install rstan.
RUN install.r rstan
# Need this in order to install specific versions of R packages.
RUN R -e 'install.packages("remotes")'
# I'm following the outlines here for the following: 
# https://github.com/rmcelreath/rethinking/#installation
RUN R -e 'install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))'
RUN R -e "cmdstanr::install_cmdstan()"
# Install rethinking package.
RUN R -e 'install.packages(c("coda","mvtnorm","devtools","loo","dagitty","shape"))'
RUN R -e 'devtools::install_github("rmcelreath/rethinking")'
# Install Rstudio - From here is what I've added to the image in order to 
# try and use Rstudio from this image.
RUN apt -y install r-base gdebi-core
RUN wget https://download1.rstudio.org/desktop/bionic/amd64/rstudio-2021.09.2-382-amd64.deb
RUN gdebi -n rstudio-2021.09.2-382-amd64.deb
CMD ["R"]

然后重建它。

最新更新