mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 08:17:26 +00:00
fake docker client can remove containers which have not been started
This commit is contained in:
parent
08ea3d2a4a
commit
0e38a0e7dd
@ -661,6 +661,15 @@ func (f *FakeDockerClient) RemoveContainer(id string, opts dockertypes.Container
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
for i := range f.RunningContainerList {
|
||||||
|
// allow removal of running containers which are not running
|
||||||
|
if f.RunningContainerList[i].ID == id && !f.ContainerMap[id].State.Running {
|
||||||
|
delete(f.ContainerMap, id)
|
||||||
|
f.RunningContainerList = append(f.RunningContainerList[:i], f.RunningContainerList[i+1:]...)
|
||||||
|
f.appendContainerTrace("Removed", id)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
// To be a good fake, report error if container is not stopped.
|
// To be a good fake, report error if container is not stopped.
|
||||||
return fmt.Errorf("container not stopped")
|
return fmt.Errorf("container not stopped")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user