@@ -33,19 +33,24 @@ func Destroy(clusterName string) error {
33
33
// Remove all container
34
34
for _ , containerInfo := range containers {
35
35
if containerInfo .Labels ["service" ] == string (model .ImageRunner ) {
36
- // Make sure the container is running before deleting secrets
37
- if err := cli .ContainerStart (ctx , containerInfo .ID , types.ContainerStartOptions {}); err != nil {
38
- return err
39
- }
40
- // NOTE: files are created with root permission in runner. If host system want to delete these files it requires root permissions.
41
- // so to delete files without root permission we remove the files from container itself
42
- execProcess , err := cli .ContainerExecCreate (ctx , containerInfo .ID , types.ExecConfig {Cmd : []string {"rm" , "-rf" , "/secrets" }})
43
- if err != nil {
44
- return err
45
- }
46
- if err := cli .ContainerExecStart (ctx , execProcess .ID , types.ExecStartCheck {}); err != nil {
47
- return err
48
- }
36
+ go func () {
37
+ // Make sure the container is running before deleting secrets
38
+ if err := cli .ContainerStart (ctx , containerInfo .ID , types.ContainerStartOptions {}); err != nil {
39
+ _ = utils .LogError ("Unable to start container to delete secrets" , err )
40
+ return
41
+ }
42
+ // NOTE: files are created with root permission in runner. If host system want to delete these files it requires root permissions.
43
+ // so to delete files without root permission we remove the files from container itself
44
+ execProcess , err := cli .ContainerExecCreate (ctx , containerInfo .ID , types.ExecConfig {Cmd : []string {"rm" , "-rf" , "/secrets" }})
45
+ if err != nil {
46
+ _ = utils .LogError ("Unable to create delete secrets execution command" , err )
47
+ return
48
+ }
49
+ if err := cli .ContainerExecStart (ctx , execProcess .ID , types.ExecStartCheck {}); err != nil {
50
+ _ = utils .LogError ("Unable to execute delete secrets command" , err )
51
+ return
52
+ }
53
+ }()
49
54
}
50
55
if err := cli .ContainerRemove (ctx , containerInfo .ID , types.ContainerRemoveOptions {Force : true }); err != nil {
51
56
_ = utils .LogError (fmt .Sprintf ("Unable to remove container %s - %s" , containerInfo .ID , err .Error ()), nil )
0 commit comments