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
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
......@@ -111,7 +111,7 @@ func runLongRunningSubProcess(ctx context.Context, name string, arg ...string) e
}
func stopRunningSamDocker() {
cli, err := client.NewEnvClient()
cli, err := client.NewClientWithOpts(client.FromEnv)
if err != nil {
panic(err)
}
......@@ -122,13 +122,23 @@ func stopRunningSamDocker() {
}
for _, container := range containers {
mustStop := false
if container.Command == "/var/rapid/aws-lambda-rie" {
mustStop = true
} else {
for _, port := range container.Ports {
if port.PrivatePort == 5986 {
mustStop = true
break
}
}
}
if mustStop {
err = cli.ContainerStop(context.Background(), container.ID, nil)
if err != nil {
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 to comment