-1

I have a Dockerfile that looks like this:

FROM image

WORKDIR /App
ADD ./App/ /App
ENTRYPOINT [ "./App" ]

In the App direction I am mounting a golang binary and its config.yml.

The image builds and runs correctly. When I am not running the container detached I can see the app is running as well.

But when I run it detached:

docker run -d image

I cannot exec into container after:

docker exec -it container bin/bash

With an error message:

OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"bin/bash\": stat bin/bash: no such file or directory": unknown

I can understand it has to do with the entrypoint I set, but i am not sure what alternative i could use.

Any ideas?

4
  • docker exec -it container bash or docker exec -it container /bin/bash
    – LinPy
    Nov 18, 2019 at 15:33
  • I use /bin/bash. Is it that different?
    – workaround
    Nov 18, 2019 at 15:34
  • no you use bin/bash
    – LinPy
    Nov 18, 2019 at 15:35
  • Yes you are right.Thanks!
    – workaround
    Nov 18, 2019 at 15:38

1 Answer 1

1

You should to specify full path to the binary file(/bin/bash in your case) or just name of the binary file located somewhere in your container's PATH variable(bash)

2
  • 1
    It's not strictly necessary to specify a full path, but you need to specify the correct path. If your working directory is /App, the path bin/bash refers to /App/bin/bash which of course doesn't exist. But the correct relative path ../bin/bash would also work. Maybe see also stackoverflow.com/questions/31435921/difference-between-and
    – tripleee
    Nov 20, 2019 at 5:32
  • Yes, you right, it's a third option - path that relevant to workdir location, I forgot about this one, thank you for your clarification
    – Sergio
    Nov 20, 2019 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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