summaryrefslogtreecommitdiff
path: root/cmd/podman/system
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/system')
-rw-r--r--cmd/podman/system/reset.go21
1 files changed, 18 insertions, 3 deletions
diff --git a/cmd/podman/system/reset.go b/cmd/podman/system/reset.go
index 0edb36889..c64d09ed2 100644
--- a/cmd/podman/system/reset.go
+++ b/cmd/podman/system/reset.go
@@ -45,16 +45,29 @@ func init() {
}
func reset(cmd *cobra.Command, args []string) {
+ // Get all the external containers in use
+ listCtn, _ := registry.ContainerEngine().ContainerListExternal(registry.Context())
+ listCtnIds := make([]string, 0, len(listCtn))
+ for _, externalCtn := range listCtn {
+ listCtnIds = append(listCtnIds, externalCtn.ID)
+ }
// Prompt for confirmation if --force is not set
if !forceFlag {
reader := bufio.NewReader(os.Stdin)
- fmt.Print(`
+ fmt.Println(`
WARNING! This will remove:
- all containers
- all pods
- all images
- - all build cache
-Are you sure you want to continue? [y/N] `)
+ - all build cache`)
+ if len(listCtn) > 0 {
+ fmt.Println(`WARNING! The following external containers will be purged:`)
+ // print first 12 characters of ID and first configured name alias
+ for _, externalCtn := range listCtn {
+ fmt.Printf(" - %s (%s)\n", externalCtn.ID[0:12], externalCtn.Names[0])
+ }
+ }
+ fmt.Print(`Are you sure you want to continue? [y/N] `)
answer, err := reader.ReadString('\n')
if err != nil {
logrus.Error(err)
@@ -65,6 +78,8 @@ Are you sure you want to continue? [y/N] `)
}
}
+ // Purge all the external containers with storage
+ registry.ContainerEngine().ContainerRm(registry.Context(), listCtnIds, entities.RmOptions{Force: true, All: true, Ignore: true, Volumes: true})
// Shutdown all running engines, `reset` will hijack repository
registry.ContainerEngine().Shutdown(registry.Context())
registry.ImageEngine().Shutdown(registry.Context())