mirror of https://github.com/k3s-io/k3s
parent
9a0f5ccb33
commit
0144803c07
|
@ -287,7 +287,6 @@ func (ds *dockerService) StopContainer(containerID string, timeout int64) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveContainer removes the container.
|
// RemoveContainer removes the container.
|
||||||
// TODO: If a container is still running, should we forcibly remove it?
|
|
||||||
func (ds *dockerService) RemoveContainer(containerID string) error {
|
func (ds *dockerService) RemoveContainer(containerID string) error {
|
||||||
// Ideally, log lifecycle should be independent of container lifecycle.
|
// Ideally, log lifecycle should be independent of container lifecycle.
|
||||||
// However, docker will remove container log after container is removed,
|
// However, docker will remove container log after container is removed,
|
||||||
|
@ -296,7 +295,7 @@ func (ds *dockerService) RemoveContainer(containerID string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = ds.client.RemoveContainer(containerID, dockertypes.ContainerRemoveOptions{RemoveVolumes: true})
|
err = ds.client.RemoveContainer(containerID, dockertypes.ContainerRemoveOptions{RemoveVolumes: true, Force: true})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to remove container %q: %v", containerID, err)
|
return fmt.Errorf("failed to remove container %q: %v", containerID, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,7 @@ func (ds *dockerService) RemovePodSandbox(podSandboxID string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the sandbox container.
|
// Remove the sandbox container.
|
||||||
if err := ds.client.RemoveContainer(podSandboxID, dockertypes.ContainerRemoveOptions{RemoveVolumes: true}); err != nil && !libdocker.IsContainerNotFoundError(err) {
|
if err := ds.client.RemoveContainer(podSandboxID, dockertypes.ContainerRemoveOptions{RemoveVolumes: true, Force: true}); err != nil && !libdocker.IsContainerNotFoundError(err) {
|
||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue