Stopping stubborn container?

2019-06-26 00:07发布

I have a container open attached to a terminal, but ctrl+C and crtl+D are not working to stop it. Ergo, I opened another terminal and tried

docker stop CONTAINER_ID

where CONTAINER_ID is the ID of the container that is hung. This did not work, and hung that terminal. So I did a little internet research which led me to try

docker kill CONTAINER_ID

in another terminal. This also hung. So I searched a little more and found

docker rm -fv CONTAINER_ID

This, unfortunately, just hung in a fourth terminal. Is there a way to shut it down through docker that I'm missing, or do I need to start kill -9ing the processes with "docker" in their description?

I'm running Docker version 17.03.0-ce, build 60ccb22 on OSX.

标签: docker
1条回答
ゆ 、 Hurt°
2楼-- · 2019-06-26 00:43

When docker hangs like that, I usually just restart the daemon and the clients will disconnect. On MacOS, that involves going to the whale drop down and running the restart from there. I often need to do this if my IP address changes.

Also, not relevant to you but may help others in the future, on earlier versions of docker (before 17.03) there is a deadlock issue especially with logs that would cause commands to hang. The solution is the same, restarting docker, but in this case I'd also recommend upgrading.

查看更多
登录 后发表回答