Properly document how to launch a shell in an image, not just a running container
The documentation lists how to properly use docker exec however it doesn't list how to get a shell in an image.
Hi @gdevenyi .
I'm not completely sure I understand the request. Are you looking for documentation of this:
docker exec -it <container> /bin/bash
or something else?
Are you looking for documentation of this:
No, I'm looking for documentation on how to get a shell in a non-running container (aka an image), where the default entrypoint has been overridden (ENTRYPOINT ["/usr/local/bin/_entrypoint.sh", "anothercommand"]), such that I get the proper container environment.
After much experimenting and reading the existing dockerfile, I think this is what I need to override:
$ docker run -it --entrypoint /usr/local/bin/_entrypoint.sh <mycontainerimage> /bin/bash
Yes, if you set a new ENTRYPOINT in a derived image and then you want to get back to the old ENTRYPOINT you can specify the old ENTRYPOINT on the command line:
$ docker run -it --entrypoint /usr/local/bin/_entrypoint.sh <mycontainerimage> /bin/bash
and if you are still using the default (or root) user you can even get away with:
$ docker run -it --entrypoint /bin/bash <mycontainerimage>
As the .bashrc for that user will activate the environment.
I will think about how this would best fit into the documentation. PRs are welcome of course....