InfrastructureR_0.1.4.tar.gz is a R source package that I created using RStudio in windows and it works fine. But when I try to use it in docker file with the command InfrastructureR_0.1.4.tar.gz is located in the same location as Docker file
Docker is running on ubuntu 18.x machine
RUN R -e "install.packages('InfrastructureR_0.1.4.tar.gz', dependencies=FALSE, verbose=TRUE, repos=NULL, type='source')"
it doesn't install.
I run the docker build by sudo docker build -t myRApp s .
and I get the following error message
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
system (cmd0): /usr/lib/R/bin/R CMD INSTALL
Warning: invalid package ‘InfrastructureR_0.1.4.tar.gz’
Error: ERROR: no packages specified
Warning message:
In install.packages("InfrastructureR_0.1.4.tar.gz", dependencies = FALSE, :
installation of package ‘InfrastructureR_0.1.4.tar.gz’ had non-zero exit status
So how do I install a custom R source package in Docker
It is not enough to have your tar.gz file in the same directory as your Dockerfile. To make a local file available to a Docker container created from an image, you can use the COPY
instruction.
The COPY
instruction copies new files or directories from <src>
and adds them to the filesystem of the container at the path <dest>
:
COPY [--chown=<user>:<group>] <src>... <dest>
More in the docker docs:
I think the package needs to be copied inside the container so that the container can access it. (or in a location volume that docker has access to)
R running inside the container cannot find the file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.