The idea is to run a a R script in a docker container. The R script works fine. Here is a pease from this R script. The script doesn*t start. If I run the script by hand from the root dir Rscript /home/script/master.R
I get an error message.
Error in file(file, ifelse(append, "a", "w")) :
cannot open the connection
Calls: write.csv -> eval.parent -> eval -> eval -> write.table -> file
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
cannot open file '../output/alpha.csv': No such file or directory
Execution halted
# Build csv file
write.csv(alpha, file = "../output/alpha.csv", row.names = FALSE)
write.csv(beta, file = "../output/beta.csv", row.names = FALSE)
write.csv(gamma, file = "../output/gamma.csv", row.names = FALSE)
I copyy the script to /home/master.r in the container
Here is my dockerfile
From rocker/r-base:latest
# Create directories
RUN mkdir -p home/data home/output home/script
# Copy files
COPY /src/data/test.csv /home/data/test.csv
COPY /src/master.R /home/script/master.R
COPY /src/install_packages.R /home/script/install_packages.R
# Install R-packages
RUN Rscript /home/script/install_packages.R
# Run the script
CMD Rscript /home/script/master.R
The second problem is, that I need groff. So I tried this: install.packages('groff', dependencies = TRUE, repos='http://cran.us.r-project.org')
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning message:
package ‘groff’ is not available (for R version 3.6.1)
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning message:
package ‘pandoc’ is not available (for R version 3.6.1)
How do I run the container.? I tried this:
docker run -it --rm test