Skip to content

Commit

Permalink
fix: prune volumes with all flag (#1989)
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge committed Feb 23, 2024
1 parent a2b241e commit bec537e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/utils/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ func DockerRemoveAll(ctx context.Context, w io.Writer) error {
}
// Remove named volumes
if NoBackupVolume {
if report, err := Docker.VolumesPrune(ctx, args); err != nil {
// Since docker engine 25.0.3, all flag is required to include named volumes.
// https://github.com/docker/cli/blob/master/cli/command/volume/prune.go#L76
vargs := args.Clone()
vargs.Add("all", "true")
if report, err := Docker.VolumesPrune(ctx, vargs); err != nil {
return errors.Errorf("failed to prune volumes: %w", err)
} else if viper.GetBool("DEBUG") {
fmt.Fprintln(os.Stderr, "Pruned volumes:", report.VolumesDeleted)
Expand Down

0 comments on commit bec537e

Please sign in to comment.