Search code examples
dockerfiledocker-entrypoint

Can't find binary when using ENTRYPOINT on Dockerfile


I am playing around with docker and this simple image

FROM golang:1.13.4-stretch

ENTRYPOINT ["/bin/bash"]

And when I try to run docker build -t test . && docker run -it --rm test "go version" I get the error /bin/bash: go version: No such file or directory

Without the ENTRYPOINT line I have no problem running it.

Also, it doesn't seem to matter which shell I use, as long as the line is there it will always fail.

Could anyone enlighten me does it behave like this?

FYI: The value of PATH inside the container when using the ENTRYPOINT doesn't include the /usr/local/go/bin (where the go exec is)


Solution

  • I believe the shell is interpreting "go version" as the command to run instead of the command go with the argument version. Try removing the quotes.