mirror of
https://github.com/docker/docs.git
synced 2026-04-12 06:19:22 +07:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user