Docker镜像从R Studio运行时出现错误



我的Dockerfile包含了statworx网站中显示的用于构建Shiny应用程序图像的确切代码。

# Base image https://hub.docker.com/u/rocker/
FROM rocker/shiny:latest
# system libraries of general use
## install debian packages
RUN apt-get update -qq && apt-get -y --no-install-recommends install 
libxml2-dev 
libcairo2-dev 
libsqlite3-dev 
libmariadbd-dev 
libpq-dev 
libssh2-1-dev 
unixodbc-dev 
libcurl4-openssl-dev 
libssl-dev
## update system libraries
RUN apt-get update && 
apt-get upgrade -y && 
apt-get clean
# copy necessary files
## app folder
COPY /example-app ./app
## renv.lock file
COPY /example-app/renv.lock ./renv.lock
# install renv & restore packages
RUN Rscript -e 'install.packages("renv")'
RUN Rscript -e 'renv::consent(provided = TRUE)'
RUN Rscript -e 'renv::restore()'
# expose port
EXPOSE 3838
# run app on container start
CMD ["R", "-e", "shiny::runApp('/app', host = '0.0.0.0', port = 3838)"]
docker build -t my-shinyapp-image . 

我得到以下错误:未能解决与前端dockerfile。dockerfile解析错误第7行:未知指令:LIBXML2-DEV

如果我删除LIBXML2-DEV包,它会在下一个包上给出错误。以前有人遇到过这个问题吗?

按照@HubertL的建议,下面是可以工作的Dockerfile:

# Base image https://hub.docker.com/u/rocker/
FROM rocker/shiny:latest
# system libraries of general use
## install Debian/Ubuntu packages
RUN apt-get update -qq && 
apt-get upgrade -y && 
apt-get -y --no-install-recommends install 
libxml2-dev 
libcairo2-dev 
libsqlite3-dev 
libmariadbd-dev 
libpq-dev 
libssh2-1-dev 
unixodbc-dev 
libcurl4-openssl-dev 
libssl-dev

## update system libraries
RUN apt-get update && 
apt-get upgrade -y && 
apt-get clean

# copy necessary files
## app folder
COPY /example-app ./app
## renv.lock file
COPY /example-app/renv.lock ./renv.lock
# install renv & restore packages
RUN Rscript -e 'install.packages("renv")'
RUN Rscript -e 'renv::consent(provided = TRUE)'
RUN Rscript -e 'renv::restore()'
# expose port
EXPOSE 3838
# run app on container start
CMD ["R", "-e", "shiny::runApp('/app', host = '0.0.0.0', port = 3838)"]

相关内容

  • 没有找到相关文章

最新更新