Issue
I'm trying to build a docker container for a tool named DECoN (versin 2.0.0). To do so, I'm doing these steps:
- start
FROM
the latest bash image RUN
the download of the tool's source code and extract it- set the
WORKDIR
to the tool's./Linux
subdirectory RUN
the existingsetup.sh
script that is found within the Linux subdirectory.
# syntax=docker/dockerfile:1
# start from a bash image
FROM bash:latest
# download files
RUN wget https://github.com/RahmanTeam/DECoN/archive/refs/tags/v2.0.0.tar.gz && \
tar -xf v2.0.0.tar.gz
# go to directory
WORKDIR DECoN-2.0.0/Linux
# run setup script
RUN setup.sh
# check directory content
RUN ls
You can see the existence of the script with the last RUN ls
. However, the script is not found and the docker build returns the following error:
docker build -t decon:2.0.0 .
...
/bin/sh: setup.sh: not found
The command '/bin/sh -c setup.sh' returned a non-zero code: 127
Do you have any idea what I'm doing wrong? I don't understand why the script is not found. I have tried setup.sh
, ./setup.sh
, /DECoN-2.0.0/Linux/setup.sh
, but nothing works.
EDIT #1: This is the content of the bash script:
#!/bin/bash
Rscript sessionInfo.R > setup.log 2>&1
Solution
To debug this kind of problems, run the base image and execute the commands of the Dockerfile
by hand on the prompt:
docker run -it --rm bash:latest
wget https://github.com/RahmanTeam/DECoN/archive/refs/tags/v2.0.0.tar.gz
tar -xf v2.0.0.tar.gz
cd DECoN-2.0.0/Linux
./setup.sh
The last line fails because, as you have noted, it runs Rscript
which is not present in your (very minimal) base image. Rscript
belongs to the R language so I have tried again with the official R base image:
docker run -it --rm r-base:latest bash
wget https://github.com/RahmanTeam/DECoN/archive/refs/tags/v2.0.0.tar.gz
tar -xf v2.0.0.tar.gz
cd DECoN-2.0.0/Linux
./setup.sh
This time the script runs and creates the following setup.log
:
# Bootstrapping renv 0.15.4 --------------------------------------------------
* Downloading renv 0.15.4 ... OK
* Installing renv 0.15.4 ... Done!
* Successfully installed and loaded renv 0.15.4.
Error: package 'BiocManager' is not available
In addition: Warning messages:
1: This project is configured to use R version '4.2.0', but '4.3.1' is currently being used.
2: could not retrieve available packages for url 'https://cran.ma.imperial.ac.uk/src/contrib'
Traceback (most recent calls last):
20: source("renv/activate.R")
19: withVisible(eval(ei, envir))
18: eval(ei, envir)
17: eval(ei, envir)
16: local(...)
15: eval.parent(substitute(eval(quote(expr), envir)))
14: eval(expr, p)
13: eval(expr, p)
12: eval(quote(...), new.env())
11: eval(quote(...), new.env())
10: renv::load()
9: renv_load_bioconductor(project, lockfile$Bioconductor)
8: renv_bioconductor_init()
7: renv_bioconductor_init_biocmanager()
6: install("BiocManager")
5: retrieve(names(remotes))
4: handler(package, renv_retrieve_impl(package))
3: renv_retrieve_impl(package)
2: stopf("package '%s' is not available", package)
1: stop(sprintf(fmt, ...), call. = call.)
Execution halted
The warning about the wrong version of R can be avoided by using r-base:4.2.0
instead of r-base:latest
(recommended to be safe) but the error message package 'BiocManager' is not available
persists.
The URL referenced in the log is still valid and BiocManager
is a package that must be installed within R. Since I'm not an expert of R, I stop my analysis here hoping it helps.
UPDATE: Searching in Docker Hub I found some ready-made images that reference RahmanTeam/DECoN
in the Dockerfile
:
This one explictly installs BiocManager
:
Other images could exist.
Answered By - Pino Answer Checked By - Timothy Miller (WPSolving Admin)