mirror of https://github.com/docker/docs.git
Port filtering: Fixed a race condition.
Port filtering used to rely on NetworkSettings, however, those are not populated until the container is started. While stopped, the filter was unaware of the port being used, resulting in a race condition. Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
ad5040c9f4
commit
f5827052a4
|
|
@ -33,7 +33,7 @@ func (p *PortFilter) Filter(config *dockerclient.ContainerConfig, nodes []*clust
|
|||
|
||||
func (p *PortFilter) portAlreadyInUse(node *cluster.Node, requested dockerclient.PortBinding) bool {
|
||||
for _, c := range node.Containers() {
|
||||
for _, port := range c.Info.NetworkSettings.Ports {
|
||||
for _, port := range c.Info.HostConfig.PortBindings {
|
||||
for _, binding := range port {
|
||||
if binding.HostPort == requested.HostPort {
|
||||
// Another container on the same host is binding on the same
|
||||
|
|
|
|||
Loading…
Reference in New Issue