Stopping paused Docker containers -


in application consisting of several containers, pause containers not needed. when needed again, unpause them. works fine.

however, if goes wrong in 1 of running containers(container exits exit code != 0), docker-compose(which using) tries stop other containers. if container paused, cannot stopped or killed.

a small example illustrate happens. (all of these commands automated in case)

docker start cd1d8ad01f56 docker pause cd1d8ad01f56 docker stop cd1d8ad01f56  error response daemon: cannot stop container cd1d8ad01f56:   container cd1d8ad01f56c695a598e168e2eacdcd20a5231b9240029db1579bc0f1dcb903   paused. unpause container before stopping error: failed stop containers: [cd1d8ad01f56] 

i want containers stopped, if paused.

solutions thought of:

  • first unpause every sleeped container, stop or kill it. unsuitable solution requires manual work. works... write script looks paused containers , unpauses , kills them. want compose kill other stuff , done it. not want have issue command execute script.

  • is there way specify code of container exits(i.e. tell unpause other containers)? containers not sleeped when trying stop them.

first unpausing every sleeped container, stop or kill tedious work, automate. working in test environment , not care how containers shutdown. want them end failed container(s).


Comments