mirror of
https://github.com/rancher/rke.git
synced 2025-05-10 09:24:32 +00:00
Avoid creating dangling volumes with rke tools
This commit is contained in:
parent
a905a6df80
commit
556e5bb678
@ -691,6 +691,7 @@ func (c *Cluster) BuildSidecarProcess() v3.Process {
|
||||
Labels: map[string]string{
|
||||
ContainerNameLabel: services.SidekickContainerName,
|
||||
},
|
||||
Command: []string{"/bin/bash"},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ func UseLocalOrPull(ctx context.Context, dClient *client.Client, hostname string
|
||||
}
|
||||
|
||||
func RemoveContainer(ctx context.Context, dClient *client.Client, hostname string, containerName string) error {
|
||||
err := dClient.ContainerRemove(ctx, containerName, types.ContainerRemoveOptions{Force: true})
|
||||
err := dClient.ContainerRemove(ctx, containerName, types.ContainerRemoveOptions{Force: true, RemoveVolumes: true})
|
||||
if err != nil {
|
||||
return fmt.Errorf("Can't remove Docker container [%s] for host [%s]: %v", containerName, hostname, err)
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ func doRunDeployer(ctx context.Context, host *hosts.Host, containerEnv []string,
|
||||
time.Sleep(5 * time.Second)
|
||||
continue
|
||||
}
|
||||
if err := host.DClient.ContainerRemove(ctx, resp.ID, types.ContainerRemoveOptions{}); err != nil {
|
||||
if err := host.DClient.ContainerRemove(ctx, resp.ID, types.ContainerRemoveOptions{RemoveVolumes: true}); err != nil {
|
||||
return fmt.Errorf("Failed to delete Certificates deployer container on host [%s]: %v", host.Address, err)
|
||||
}
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user