Docker and webdriver

I am trying to install the webdriver package but there might be an issue with my Dockerfile and the way I run the webdriver::install_phantomjs() function.

My Dockerfile looks like this.

FROM rocker/verse

RUN install2.r --error \
  rJava \
  plumber \
  webdriver \
  mailR \
  DBI \
  RPostgres

RUN R -e 'webdriver::install_phantomjs()'

RUN rm -rf /tmp/downloaded_packages/ /tmp/*.rds

The error I get is below. First the file is downloaded and then the errors begin.

2019-10-16 17:33:29 (7.79 MB/s) - ‘phantomjs-2.1.1-linux-x86_64.tar.bz2’ saved [23415665/23415665]

tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: Error is not recoverable: exiting now
Error in webdriver::install_phantomjs() :
  Unable to install PhantomJS to any of these dirs: ~/bin,
In addition: Warning messages:
1: In utils::untar(zipfile) :
  ‘/bin/tar -jxf 'phantomjs-2.1.1-linux-x86_64.tar.bz2'’ returned error code 2
2: In file.copy(exec, destdir, overwrite = TRUE) :
  problem copying phantomjs-2.1.1-linux-x86_64/bin/phantomjs to /root/bin/phantomjs: No such file or directory
Execution halted
The command '/bin/sh -c R -e 'webdriver::install_phantomjs()'' returned a non-zero code: 1

I hope someone can help.

I can't says what going on in your dockerfile but just to share about webscraping, know that phantomJS is no more maintained.There is other tools that could do the job as well
See

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.