Docker

下載了較新的圖像 - docker:來自守護程序的錯誤響應:OCI 執行時創建失敗:container_linux.go:348:

  • December 8, 2018

我想下載busybox圖像並得到它,但儘管如此,我還是有以下錯誤:

λ bgarcial [~] → sudo docker run busybox:1.29 "hello world"
Unable to find image 'busybox:1.29' locally
1.29: Pulling from library/busybox
90e01955edcd: Already exists 
Digest: sha256:2a03a6059f21e150ae84b0973863609494aad70f0a80eaeb64bddd8d92465812
Status: Downloaded newer image for busybox:1.29
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"hello world\": executable file not found in $PATH": unknown.
ERRO[0004] error waiting for container: context canceled 

λ bgarcial [~] → sudo docker images                        
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
busybox             1.29                59788edf1f3e        2 months ago        1.15MB
hello-world         latest              4ab4c602aa5e        3 months ago        1.84kB

λ bgarcial [~] →

使用其他圖像不會發生相同的錯誤,例如命令sudo docker run mongo:4-xenial

當我將“hello world”作為參數傳遞到我的容器中時,我的問題是否可能是?

當您將命令傳遞給 Docker 容器時,它必須可以從 Docker 容器內的 shell 執行。在這種情況下,“Hello World”被視為您嘗試執行的執行檔的名稱。由於這不是一個有效的執行檔名,Docker 返回以下錯誤。

[root@testvm1 test]# docker run busybox "Hello World"
container_linux.go:247: starting container process caused "exec: \"Hello World\": executable file not found in $PATH"
/usr/bin/docker-current: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"Hello World\": executable file not found in $PATH".

注意這一行:"exec: \"Hello World\": executable file not found in $PATH".

使用容器內有效的命令,例如echo

[root@testvm1 test]# docker run busybox echo "Hello World"
Hello World

請注意,如果您使用 shell 以互動方式執行容器,您將看到相同的行為:

[root@testvm1 test]# docker run -it busybox /bin/sh
/ # "Hello World"
/bin/sh: Hello World: not found
/ # echo "Hello World"
Hello World

引用自:https://unix.stackexchange.com/questions/486713