1

I am trying to run the official bwa docker https://hub.docker.com/r/biocontainers/bwa/, and I keep getting an error:

sudo docker run -u="root" -v ~/files/:/opt/inputs/ biocontainers/bwa "index /opt/inputs/hg19.fa"
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"index /opt/inputs/hg19.fa\": stat index /opt/inputs/hg19.fa: no such file or directory": unknown.
ERRO[0000] error waiting for container: context canceled 

EDIT: Removing the double quotes from the lst string gives a different error:

sudo docker run -u="root" -v ~/files/:/opt/inputs/ biocontainers/bwa index /opt/inputs/hg19.fa
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"index\": executable file not found in $PATH": unknown.

I have found the reason behind it here:

docker: executable file not found in $PATH

This is the correct reason, but since this file was pre-build, and I want to use the official release, I cannot change the CMD synthax in Dockerfile. How can I make this work without changing the container itself?

1 Answer 1

3

since this file was pre-build, and I want to use the official release, I cannot change the CMD synthax in Dockerfile

Actually you did change the setting of CMD in your run command. Everything after the image name overrides the default CMD value shipped with the image:

sudo docker run -u="root" -v ~/files/:/opt/inputs/ biocontainers/bwa "index /opt/inputs/hg19.fa"
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"index /opt/inputs/hg19.fa\": stat index /opt/inputs/hg19.fa: no such file or directory": unknown.
ERRO[0000] error waiting for container: context canceled 

In this case, you have replaced the bwa value of CMD shipped in the Dockerfile with "index /opt/inputs/hg19.fa". Note the quotes and space are included in the executable you are trying to run. It is not trying to run index with an argument /opt/inputs/hg19.fa as you may have expected. This is why you see the error message:

"exec: \"index /opt/inputs/hg19.fa\": stat index /opt/inputs/hg19.fa: no such file or directory"

To run the command index, remove the quotes:

sudo docker run -u="root" -v ~/files/:/opt/inputs/ biocontainers/bwa index /opt/inputs/hg19.fa
Sign up to request clarification or add additional context in comments.

6 Comments

I am sorry, I posted the wrong error message, as I tried multiple versions of the command. I initially tried without it, and the error is: docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"index\": executable file not found in $PATH": unknown.
If you need a binary that is not included with the image you've selected, you'll need to pick a different image, extend image, or include the install of that binary with your running of the image.
Got it, just add bwa. Accepted the answer. Can you tell me how to not override the command but add arguments to it? Is that even possible if the last line is: CMD ["bwa"] ?
The value is CMD is always overridden, not extended. It sounds like you're looking for the behavior of ENTRYPOINT. docs.docker.com/engine/reference/builder/…
Then why specify such a CMD? Which cannot possibly do anything, apart from print help.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.