0

I want to download the busybox image and I get it but despite it I have the following error:

λ 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 [~] →

With other images don't happen the same error, like the command sudo docker run mongo:4-xenial ...

Is possible that my problem could be when I pass the "hello world" as an argument to execute into my container?

  • 2
    You should use echo "hello world"; what you passed isn't a valid shell command so the container didn't know how to run it, same as if you typed it on a command line. – Stephen Harris Dec 8 '18 at 4:01
4

When you pass a command to the Docker container, it has to be executable from the shell inside the Docker container. In this case, 'Hello World' is treated as the name of the executable you are trying to run. Since this is not a valid executable name, Docker returns the following error.

[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".

Note the line: "exec: \"Hello World\": executable file not found in $PATH".

Use a command valid inside the container, such as echo for this to work:

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

Note that you will see the same behaviour if you run the container interactively by using a shell:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.