1
0
mirror of https://github.com/rancher/rke.git synced 2025-08-01 23:33:39 +00:00

Avoid creating dangling volumes with rke tools

This commit is contained in:
galal-hussein 2019-01-21 22:05:59 +02:00 committed by Alena Prokharchyk
parent a905a6df80
commit 556e5bb678
3 changed files with 3 additions and 2 deletions

View File

@ -691,6 +691,7 @@ func (c *Cluster) BuildSidecarProcess() v3.Process {
Labels: map[string]string{ Labels: map[string]string{
ContainerNameLabel: services.SidekickContainerName, ContainerNameLabel: services.SidekickContainerName,
}, },
Command: []string{"/bin/bash"},
} }
} }

View File

@ -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 { 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 { if err != nil {
return fmt.Errorf("Can't remove Docker container [%s] for host [%s]: %v", containerName, hostname, err) return fmt.Errorf("Can't remove Docker container [%s] for host [%s]: %v", containerName, hostname, err)
} }

View File

@ -109,7 +109,7 @@ func doRunDeployer(ctx context.Context, host *hosts.Host, containerEnv []string,
time.Sleep(5 * time.Second) time.Sleep(5 * time.Second)
continue 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 fmt.Errorf("Failed to delete Certificates deployer container on host [%s]: %v", host.Address, err)
} }
return nil return nil