Skip to content
Snippets Groups Projects
Commit 75e9a9e7 authored by Jan Semmelink's avatar Jan Semmelink
Browse files

Implemented a fix

parent 57694248
No related branches found
No related tags found
1 merge request!1Fix for mage run does not stop containers
...@@ -111,7 +111,7 @@ func runLongRunningSubProcess(ctx context.Context, name string, arg ...string) e ...@@ -111,7 +111,7 @@ func runLongRunningSubProcess(ctx context.Context, name string, arg ...string) e
} }
func stopRunningSamDocker() { func stopRunningSamDocker() {
cli, err := client.NewEnvClient() cli, err := client.NewClientWithOpts(client.FromEnv)
if err != nil { if err != nil {
panic(err) panic(err)
} }
...@@ -122,13 +122,23 @@ func stopRunningSamDocker() { ...@@ -122,13 +122,23 @@ func stopRunningSamDocker() {
} }
for _, container := range containers { for _, container := range containers {
mustStop := false
if container.Command == "/var/rapid/aws-lambda-rie" {
mustStop = true
} else {
for _, port := range container.Ports { for _, port := range container.Ports {
if port.PrivatePort == 5986 { if port.PrivatePort == 5986 {
mustStop = true
break
}
}
}
if mustStop {
err = cli.ContainerStop(context.Background(), container.ID, nil) err = cli.ContainerStop(context.Background(), container.ID, nil)
if err != nil { if err != nil {
panic(err) panic(err)
} }
} log.Printf("Stopped container %s\n", container.ID)
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment