-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?

workaround
  • 498
  • 6
  • 19

1 Answers1

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)

Sergio
  • 823
  • 1
  • 10
  • 24
  • 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 https://stackoverflow.com/questions/31435921/difference-between-and – tripleee Nov 20 '19 at 05: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 '19 at 09:21