-
Notifications
You must be signed in to change notification settings - Fork 174
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
[specific ci=3-03-Docker-Compose-Basic] Unbind container in containerRm #6209
Conversation
Will this actually solve the issue with |
@hmahmood I think the original issue can be fixed by doing this. The reason why the failure occurs is that the container is removed before it is unbound, and that |
Deleting |
So if I call |
Why do we not have a special case for |
@hmahmood If The failure occurs because About why I didn't have a special case checking |
What about port mappings? Do they also get unmapped when with a |
@hmahmood ContainerKill() calls container_proxy.Signal(), which would unmap the ports if the state is not In this case, I think I can move |
default: | ||
return "", InternalServerError(err.Error()) | ||
} | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think the else
block is needed - we can just say
if err != nil {
...
}
return ub.Payload.Handle, nil
@@ -835,6 +826,28 @@ func (c *ContainerProxy) Stop(vc *viccontainer.VicContainer, name string, second | |||
return nil | |||
} | |||
|
|||
func (c *ContainerProxy) UnbindContainerFromNetwork(vc *viccontainer.VicContainer, handle string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have function comments for exported functions.
|
||
handle, err := c.Handle(id, name) | ||
if err != nil { | ||
return err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a docker-typed error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. It returns either NotFoundError
or InternalServerError
.
@@ -835,6 +826,27 @@ func (c *ContainerProxy) Stop(vc *viccontainer.VicContainer, name string, second | |||
return nil | |||
} | |||
|
|||
// UnbindContainerFromNetwork unbinds a container from the networks that it connects to | |||
func (c *ContainerProxy) UnbindContainerFromNetwork(vc *viccontainer.VicContainer, handle string) (string, error) { | |||
defer trace.End(trace.Begin("")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be worthwhile to trace on the container ID here?
464cb3e
to
567f9c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Fixes #5948
This PR tries to unbind the container in the before removing the container.
This may potentially degrade the performance of containerRm. However, since the PL will not do anything if the container is already unbound, its impact on performance may be neligible.