New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker exec
in stopped containers
#30361
Comments
ping @crosbymichael @mlaventure IIRC, RunC had an option to exec into a stopped container? Is this something that could be done, or not? |
@yajo Normally the image of the last step that failed still exist, you can e.g.:
|
Maybe that's an option... I guess if the hashes said what they are, it would be easier to guess that:
In any case, that still counts as workaround IMHO. |
I strongly agree docker should support start a stopped container with custom command, it could make debug easier. |
Related workaround: #18078 (comment) FWIW, I would also love a 'built in' way to do this, rather than having to script around it, even if all it ends up doing is the above. |
Until there's a good way to do this, users can be pointed to this document, which explains well the problem and its workaround. |
@Chealer looks like the same as was linked in the comment above yours;
|
Description
Currently there's no way to execute an arbitrary command in a stopped container.
Although this is by design right now, this design presents one problem: you cannot inspect a container whose build failed straight away.
Steps to reproduce the issue:
docker build --tag some-failing-image .
docker ps -a
shows that the container that failed is calledpensive_fermi
.Dockerfile
:docker exec pensive_fermi sh
.Describe the results you received:
Error response from daemon: Container a212058e9a8bf7354c63bf293481c96a22d91e97fcd4c43421a99c9eb328cf1c is not running
Describe the results you expected:
docker exec
should have a--boot
(or similar) flag that let you boot the container with this command if it is stopped, ordocker start
should let you pass a new command when restarting it.Additional information you deem important (e.g. issue happens only occasionally):
Possible workarounds/drawbacks:
docker start
it and thendocker exec
it. Problem: what if not? What if the command simply fails and exits straight away?Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
local linux
The text was updated successfully, but these errors were encountered: