简体   繁体   中英

How to exec into Docker container with ENTRYPOINT in its Dockerfile

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?

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 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM