Skip to content

Commit

Permalink
remove Dapr placement image on uninstall and init (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaron2 authored Nov 12, 2019
1 parent d793380 commit 228e5be
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var InitCmd = &cobra.Command{
}
print.SuccessStatusEvent(os.Stdout, "Success! Dapr has been installed. To verify, run 'kubectl get pods -w' in your terminal")
} else {
standalone.Uninstall(false, dockerNetwork)
err := standalone.Init(runtimeVersion, dockerNetwork)
if err != nil {
print.FailureStatusEvent(os.Stdout, err.Error())
Expand Down
2 changes: 1 addition & 1 deletion cmd/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var UninstallCmd = &cobra.Command{

func init() {
UninstallCmd.Flags().BoolVar(&uninstallKubernetes, "kubernetes", false, "Uninstall Dapr from a Kubernetes cluster")
UninstallCmd.Flags().BoolVar(&uninstallAll, "all", false, "Remove the redis container as well")
UninstallCmd.Flags().BoolVar(&uninstallAll, "all", false, "Remove Redis container in addition to actor placement container")
UninstallCmd.Flags().StringVarP(&uninstallDockerNetwork, "network", "", "", "The Docker network from which to remove the Dapr runtime")
RootCmd.AddCommand(UninstallCmd)
}
11 changes: 11 additions & 0 deletions pkg/standalone/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package standalone

import (
"errors"
"fmt"

"github.com/dapr/cli/utils"
)
Expand All @@ -17,6 +18,16 @@ func Uninstall(uninstallAll bool, dockerNetwork string) error {
errorMessage += "Could not delete Dapr Placement Container - it may not have been running "
}

err = utils.RunCmdAndWait(
"docker", "rmi",
"--force",
daprDockerImageName)

errorMessage = ""
if err != nil {
errorMessage += fmt.Sprintf("Could not delete image %s - it may not be present on the host", daprDockerImageName)
}

if uninstallAll {
err = utils.RunCmdAndWait(
"docker", "rm",
Expand Down

0 comments on commit 228e5be

Please sign in to comment.