Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

titan doesn't clean up containers in the CREATED state #93

Closed
eschrock opened this issue Nov 4, 2019 — with Slack · 0 comments · Fixed by #138
Closed

titan doesn't clean up containers in the CREATED state #93

eschrock opened this issue Nov 4, 2019 — with Slack · 0 comments · Fixed by #138
Labels
Priority: Important Address ahead of normal issues Type: Bug Something isn't working

Comments

Copy link
Contributor

eschrock commented Nov 4, 2019

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.

@eschrock eschrock added the Type: Bug Something isn't working label Nov 4, 2019 — with Slack
@mcred mcred added the Priority: Important Address ahead of normal issues label Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Important Address ahead of normal issues Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants