泊坞窗:在不更改CMD的情况下,在$ PATH解决方案中找不到可执行文件

时间:2018-10-15 11:48:15

标签: linux docker

我正在尝试运行官方的bwa docker https://hub.docker.com/r/biocontainers/bwa/,但我不断收到错误消息:

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 

编辑:从第一个字符串中删除双引号会产生不同的错误:

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.

我在这里找到了背后的原因:

docker: executable file not found in $PATH

这是正确的原因,但是由于此文件是预构建的,并且我想使用正式版本,因此无法更改Dockerfile中的CMD synthax。如何在不更改容器本身的情况下完成这项工作?

1 个答案:

答案 0 :(得分:3)

  

由于该文件是预构建的,并且我想使用正式版本,所以我无法更改Dockerfile中的CMD合成器

实际上,您确实在运行命令中更改了CMD的设置。图片名称后面的所有内容都会覆盖图片随附的默认CMD值:

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 

在这种情况下,您已经用bwa替换了Dockerfile中随附的CMD的"index /opt/inputs/hg19.fa"值。请注意引号和空格包含在您要运行的可执行文件中。它没有像您期望的那样尝试使用参数index运行/opt/inputs/hg19.fa。这就是为什么您看到错误消息的原因:

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

要运行命令index,请删除引号:

sudo docker run -u="root" -v ~/files/:/opt/inputs/ biocontainers/bwa index /opt/inputs/hg19.fa
相关问题