I had a docker image that was building successfully for months. However, since Dec 17th I've run into the error shown in the Jenkins console output below. Nothing has changed in the dockerfile so it's clearly something to do with the underlying environment, I have a Jenkins server running on AWS EC2. The strange thing is all the other packages are installing fine without any reference to R_HOME, it's just the XML package install that's failing
I've tried explicitly setting R_HOME in the dockerfile as per this thread but no luck.
ENV R_HOME /usr/lib/R
Jenkins stage
stage ('Build docker image') {
steps {
dir ('DockerImage') {
sh 'docker-compose build'
}
}
}
Jenkins console output
Step 17/20 : RUN R -e "install.packages('XML')"
---> Running in cfc007e0ce94
[91mERROR: R_HOME ('/usr/lib/R') not found
Dockerfile
# Run executable JAR in Linux
FROM cardcorp/r-java
# Set R and jri PATH
ENV LD_LIBRARY_PATH "$LD_LIBRARY_PATH:/usr/bin/:/usr/lib/R/site-library/rJava/jri/"
# Install packages in R
RUN R -e "install.packages(c('data.table', 'Rcpp', 'zoo'))"
RUN R -e "install.packages('foreach')"
RUN R -e "install.packages('doParallel')"
RUN R -e "install.packages('signal')"
RUN R -e "install.packages('bitops')"
RUN R -e "install.packages('matlab')"
RUN R -e "install.packages('GENEAread')"
RUN R -e "install.packages('tuneR')"
RUN R -e "system('apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ABC')"
RUN R -e "system('apt-key adv --keyserver keyserver.ubuntu.com --recv-keys XYZ')"
RUN R -e "system('apt-get update && apt-get install -y gcc-8-base apt-transport-https')"
RUN R -e "system('apt-get install -y libxml2-dev')"
RUN R -e "install.packages('XML')"
Edit: Looking at the timestamp of when the issue started occurring, I spotted that there was a Debian release which coincides with my issue. I wonder if it's possible to specify the Debian version to use in the Docker file
In my case I tracked the issue down to test -x not working. The /usr/bin/R script uses that to check if the /usr/lib/R folder exists.
Searching for solutions to this sent me to various bug reports in Ubuntu but I managed to resolve the issue by upgrading docker version. My Docker host is Centos not Ubuntu like in most bug reports, however my container is based on Ubuntu.
Things worked again after upgrading Docker to the following packages:
Upgraded:
containerd.io-1.4.12-3.1.el8.x86_64
docker-ce-3:20.10.12-3.el8.x86_64
docker-ce-cli-1:20.10.12-3.el8.x86_64
docker-scan-plugin-0.12.0-3.el8.x86_64
Installed:
docker-ce-rootless-extras-20.10.12-3.el8.x86_64
fuse-overlayfs-1.7.1-1.module_el8.5.0+890+6b136101.x86_64
fuse3-3.2.1-12.el8.x86_64
fuse3-libs-3.2.1-12.el8.x86_64
libslirp-4.4.0-1.module_el8.5.0+890+6b136101.x86_64
slirp4netns-1.1.8-1.module_el8.5.0+890+6b136101.x86_64
See: