Install packages from source failing – Dockerfile

I am trying to install some packages from source (including package that I have created that installed fine with R console or even when R CMD install.

However, while building docker-image using a docker file. I get this error with for this line in the docker file

RUN R -e 'install.packages("RcppDIUtilsPackage_1.0.tar.gz",repos=NULL,type="source")'

I also tried many other commands including R CMD INSTALL all work fine to install the package except within the docker image build.

Here is the error i am encountering.

Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning: invalid package ‘RcppDIUtilsPackage_1.0.tar.gz’
Error: ERROR: no packages specified
Warning message:
In install.packages("RcppDIUtilsPackage_1.0.tar.gz", repos = NULL,  :
  installation of package ‘RcppDIUtilsPackage_1.0.tar.gz’ had non-zero exit status

Thanks!!

Source: StackOverflow