diff --git a/internal/ucind/cluster.go b/internal/ucind/cluster.go index 2c92682d..8246fd5c 100644 --- a/internal/ucind/cluster.go +++ b/internal/ucind/cluster.go @@ -279,7 +279,12 @@ func (p *Provisioner) RemoveCluster(ctx context.Context, name string) error { return fmt.Errorf("list Docker containers with cluster name '%s': %w", name, err) } for _, c := range containers { - if err = p.dockerCli.ContainerRemove(ctx, c.ID, container.RemoveOptions{Force: true}); err != nil { + removeOpts := container.RemoveOptions{ + // Remove anonymous volumes attached to the container (typically /var/lib/docker). + RemoveVolumes: true, + Force: true, + } + if err = p.dockerCli.ContainerRemove(ctx, c.ID, removeOpts); err != nil { return fmt.Errorf("remove Docker container '%s': %w", c.ID, err) } }