File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ func (c *Uninstall) run() {
101101 output .Fatal ("Operation cancelled." )
102102 }
103103 }
104- if ! c .force {
104+ if controller . ContainerExists ( id ) && ! c .force {
105105 output .Infof ("Verifying no user (non-system) database (.mdf) files" )
106106 if ! controller .ContainerRunning (id ) {
107107 output .FatalfWithHintExamples ([][]string {
@@ -112,16 +112,20 @@ func (c *Uninstall) run() {
112112 c .userDatabaseSafetyCheck (controller , id )
113113 }
114114
115- output .Infof (
116- "Stopping %s" ,
117- endpoint .ContainerDetails .Image ,
118- )
119- err := controller .ContainerStop (id )
120- c .CheckErr (err )
121-
122115 output .Infof ("Removing context %s" , config .CurrentContextName ())
123- err = controller .ContainerRemove (id )
124- c .CheckErr (err )
116+
117+ if controller .ContainerExists (id ) {
118+ output .Infof (
119+ "Stopping %s" ,
120+ endpoint .ContainerDetails .Image ,
121+ )
122+ err := controller .ContainerStop (id )
123+ c .CheckErr (err )
124+ err = controller .ContainerRemove (id )
125+ c .CheckErr (err )
126+ } else {
127+ output .Warnf ("Container %q no longer exists, continuing to remove context..." , id )
128+ }
125129 }
126130
127131 config .RemoveCurrentContext ()
You can’t perform that action at this time.
0 commit comments