generated from titan-data/template
-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Labels
Priority: ImportantAddress ahead of normal issuesAddress ahead of normal issuesType: BugSomething isn't workingSomething isn't working
Description
If you have a port conflict when trying to clone a container, then you'll end up with the container in the Created state. The clone will fail and try to clean it up, but it doesn't end up deleting the container:
println("Removing container $container")
if (docker.containerIsRunning(container)) {
docker.rm(container, force)
} else {
docker.rmStopped(container)
}
}
fun containerIsRunning(container: String): Boolean {
val result = executor.exec(listOf("docker", "ps", "-f", "name=$container", "--format", "\"{{.Names}}\""))
return result.isNotEmpty()
}
fun rmStopped(container:String): String {
val containerId = executor.exec(listOf("docker", "ps", "-f", "status=exited", "-f", "name=$container", "--format", "{{.ID}}")).trim()
return executor.exec(listOf("docker", "container", "rm", containerId))
}
If you’re stuck in the “CREATED” state, you are not running, but also not exited. Think we should always just be doing a forced rm, not sure why we're filtering by status=exited.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Priority: ImportantAddress ahead of normal issuesAddress ahead of normal issuesType: BugSomething isn't workingSomething isn't working