mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00
Shut down containers when force stopping the runtime
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #68 Approved by: rhatdan
This commit is contained in:
@ -211,6 +211,20 @@ func (r *Runtime) Shutdown(force bool) error {
|
||||
|
||||
r.valid = false
|
||||
|
||||
// Shutdown all containers if --force is given
|
||||
if force {
|
||||
ctrs, err := r.state.AllContainers()
|
||||
if err !=nil {
|
||||
logrus.Errorf("Error retrieving containers from database: %v", err)
|
||||
} else {
|
||||
for _, ctr := range ctrs {
|
||||
if err := ctr.Stop(ctrRemoveTimeout); err != nil {
|
||||
logrus.Errorf("Error stopping container %s: %v", ctr.ID(), err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_, err := r.store.Shutdown(force)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user