Merge pull request #40 from andyz-dev/reclaim-volumes

[Enhancement] Automatically reclaim k3s container volumes after a cluster is deleted
pull/52/head
Andy Zhou 5 years ago committed by GitHub
commit 62f7071ee5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      cli/container.go

@ -196,7 +196,13 @@ func removeContainer(ID string) error {
if err != nil {
return fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
}
if err := docker.ContainerRemove(ctx, ID, types.ContainerRemoveOptions{Force: true}); err != nil {
options := types.ContainerRemoveOptions{
RemoveVolumes: true,
Force:true,
}
if err := docker.ContainerRemove(ctx, ID, options); err != nil {
return fmt.Errorf("FAILURE: couldn't delete container [%s] -> %+v", ID, err)
}
return nil

Loading…
Cancel
Save