Reputation: 7594
If I run the following from the command line.
docker run -t repo:tag ls -l
the command succeeds just fine. However, if I invoke the same from within a bash script I get the following ERROR:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"ls -l\": executable file not found in $PATH": unknown.
What about the bash script causes this error?
Upvotes: 0
Views: 1961
Reputation: 16304
"exec: \"ls -l\": executable file not found in $PATH"
From the error I can tell that when you invoke docker, you somehow invoke with ls -l
including space as one argument. Something like,
docker run -t repo:tag "ls -l" # wrong
or perhaps
cmd="ls -l"
docker run -t repo:tag "$cmd" # wrong
The shell to parse the docker command must see ls
and -l
as separate parameters so that the argument -l
is distinguished from the ls
executable name.
cmd="ls -l"
docker run -t repo:tag $cmd #works
Upvotes: 1