containerit
containerit copied to clipboard
Fix installed package detection for plumber image
The trestletech/plumber
image also sets an ENTRYPOINT
, which breaks detection of installed packages:
> containerit::get_installed_packages("trestletech/plumber")
Detected API version '1.40' is above max version '1.39'; downgrading
INFO [2019-11-12 12:29:31] Running command Rscript -e write.csv(x = as.data.frame(installed.packages())[,c("Version")]) in trestletech/plumber
Detected API version '1.40' is above max version '1.39'; downgrading
ARGUMENT 'Rscript' __ignored__
R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> pr <- plumber::plumb(commandArgs()[4]); pr$run(host='0.0.0.0', port=8000)
Error in plumber::plumb(commandArgs()[4]) : File does not exist: Rscript
Execution halted
Here are a few attempts to fix that, none of them working yet:
cmd = c("Rscript", "-e", "write.csv(x = as.data.frame(installed.packages())[,c(\"Version\")])")
> client$container$run(image = "trestletech/plumber", cmd = cmd, rm = TRUE, entrypoint = "/bin/bash")
/usr/bin/Rscript: /usr/bin/Rscript: cannot execute binary file
Error: Command 'Rscript -e write.csv(x = as.data.frame(installed.packages())[,c("Version")])' in image 'trestletech/plumber:latest' returned non-zero exit status 126
/usr/bin/Rscript: /usr/bin/Rscript: cannot execute binary file
> client$container$run(image = "trestletech/plumber", cmd = cmd, rm = TRUE, entrypoint = "/bin/sh")
/bin/sh: 0: Can't open Rscript
Error: Command 'Rscript -e write.csv(x = as.data.frame(installed.packages())[,c("Version")])' in image 'trestletech/plumber:latest' returned non-zero exit status 127
/bin/sh: 0: Can't open Rscript
> client$container$run(image = "trestletech/plumber", cmd = cmd, rm = TRUE, entrypoint = "bash")
/usr/bin/Rscript: /usr/bin/Rscript: cannot execute binary file
Error: Command 'Rscript -e write.csv(x = as.data.frame(installed.packages())[,c("Version")])' in image 'trestletech/plumber:latest' returned non-zero exit status 126
/usr/bin/Rscript: /usr/bin/Rscript: cannot execute binary file
> client$container$run(image = "trestletech/plumber", cmd = cmd, rm = TRUE, entrypoint = "/bin/sh")
/bin/sh: 0: Can't open Rscript
Error: Command 'Rscript -e write.csv(x = as.data.frame(installed.packages())[,c("Version")])' in image 'trestletech/plumber:latest' returned non-zero exit status 127
/bin/sh: 0: Can't open Rscript
> client$container$run(image = "trestletech/plumber", cmd = c("Rscript", "-e", "sessionInfo()"), rm = TRUE, entrypoint = "/bin/sh")
/bin/sh: 0: Can't open Rscript
Error: Command 'Rscript -e sessionInfo()' in image 'trestletech/plumber:latest' returned non-zero exit status 127
/bin/sh: 0: Can't open Rscript
> client$container$run(image = "trestletech/plumber", cmd = c("Rscript -e 'sessionInfo()'"), rm = TRUE, entrypoint = "/bin/sh")
/bin/sh: 0: Can't open Rscript -e 'sessionInfo()'
Error: Command 'Rscript -e 'sessionInfo()'' in image 'trestletech/plumber:latest' returned non-zero exit status 127
/bin/sh: 0: Can't open Rscript -e 'sessionInfo()'