Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove Dapr placement image on uninstall and init #204

Merged
merged 1 commit into from
Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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