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

[skip ci] Remove dangling container during network rm #6190

Closed
wants to merge 2 commits into from

Conversation

chengwang86
Copy link
Contributor

@chengwang86 chengwang86 commented Sep 1, 2017

Fixes #5948 .

The reason we observe network has active endpoints failure during docker-compose down is because that a container is already removed from the PL container cached but still exists in the network layer container cache. We refer to such a container as a dangling container on the network.

In this PR, when network rm is called, we remove these dangling containers (if any).

@chengwang86 chengwang86 changed the title [specific ci=3-03-Docker-Compose-Basic]remove dangling container during network rm [skip ci] WIP: Remove dangling container during network rm Sep 1, 2017
@chengwang86 chengwang86 changed the title [skip ci] WIP: Remove dangling container during network rm [skip ci] Remove dangling container during network rm Sep 1, 2017
// remove dangling endpoints
if exec.Containers != nil {
for _, eps := range s.Endpoints() {
if exec.Containers.Container(eps.ID().String()) == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit: instead of calling eps.ID().String() 3 times here you could assign it a variable once and then just use that variable instead :) will make the code a little more friendly to read.

@chengwang86 chengwang86 closed this Sep 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants