我尝试在docker容器中使用webshot (和phantomjs
请看一下这个最小的Dockerfile
FROM rocker/geospatial
RUN R -e 'webshot::install_phantomjs()'
RUN apt-get update -qq && apt-get install -qy \
ca-certificates \
bzip2 \
curl \
libfontconfig \
--no-install-recommends \
&& curl -SL https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 > phantom.tar.bz2 \
&& bzip2 -d ./phantom.tar.bz2 \
&& tar -xvf ./phantom.tar -C /usr/local/ --strip-components=1 \
&& rm phantom.tar \
&& apt-get -qy remove bzip2 curl \
&& rm -rf /var/lib/apt/lists/*然后
docker build . -t test
docker run -it test bash在R内部
webshot:::find_phantom() #"/usr/local/bin/phantomjs"
system("ping www.r-project.org") # ok
webshot::webshot("https://www.r-project.org/", "r.png") # nothing happend知道为什么吗?
谢谢
发布于 2018-12-15 05:53:58
这可能是因为在默认情况下,您位于发行版的根目录,不能在其上编写代码。
如果我尝试这样做:
~$ docker run -it rocker/geospatial bash
~$ R
> webshot::install_phantomjs()
> webshot:::find_phantom()1 "/root/bin/phantomjs“
> list.files() # At the root /
> setwd("/home/rstudio/kitematic/") # Go to allowed directory
> webshot::webshot("https://www.r-project.org/", "r.png")
> list.files()1 "r.png“
https://stackoverflow.com/questions/53785203
复制相似问题