1package main 2 3import ( 4 "path/filepath" 5 6 winio "github.com/Microsoft/go-winio" 7 "github.com/Microsoft/hcsshim" 8 "github.com/Microsoft/hcsshim/internal/appargs" 9 10 "github.com/urfave/cli" 11) 12 13var removeCommand = cli.Command{ 14 Name: "remove", 15 Usage: "permanently removes a layer directory in its entirety", 16 ArgsUsage: "<layer path>", 17 Before: appargs.Validate(appargs.NonEmptyString), 18 Action: func(context *cli.Context) (err error) { 19 path, err := filepath.Abs(context.Args().First()) 20 if err != nil { 21 return err 22 } 23 24 err = winio.EnableProcessPrivileges([]string{winio.SeBackupPrivilege, winio.SeRestorePrivilege}) 25 if err != nil { 26 return err 27 } 28 29 return hcsshim.DestroyLayer(driverInfo, path) 30 }, 31} 32