This code only needed to know whether the container was paused; for other
states ("restarting", "running"), it's still used to be included in the
error string.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -88,10 +88,10 @@ func (daemon *Daemon) rmLink(cfg *config.Config, ctr *container.Container, name |
| 88 | 88 |
func (daemon *Daemon) cleanupContainer(ctr *container.Container, config backend.ContainerRmConfig) error {
|
| 89 | 89 |
if ctr.IsRunning() {
|
| 90 | 90 |
if !config.ForceRemove {
|
| 91 |
- if state := ctr.StateString(); state == "paused" {
|
|
| 92 |
- return errdefs.Conflict(fmt.Errorf("cannot remove container %q: container is %s and must be unpaused first", ctr.Name, state))
|
|
| 91 |
+ if ctr.Paused {
|
|
| 92 |
+ return errdefs.Conflict(fmt.Errorf("cannot remove container %q: container is paused and must be unpaused first", ctr.Name))
|
|
| 93 | 93 |
} else {
|
| 94 |
- return errdefs.Conflict(fmt.Errorf("cannot remove container %q: container is %s: stop the container before removing or force remove", ctr.Name, state))
|
|
| 94 |
+ return errdefs.Conflict(fmt.Errorf("cannot remove container %q: container is %s: stop the container before removing or force remove", ctr.Name, ctr.StateString()))
|
|
| 95 | 95 |
} |
| 96 | 96 |
} |
| 97 | 97 |
if err := daemon.Kill(ctr); err != nil && !isNotRunning(err) {
|