Skip to content

race conditions lead to duplicate docker networks #20648

@rpeleg1970

Description

@rpeleg1970

When using docker network create, or via docker-compose - concurrent calls will create a duplicate network.

Output of docker version:

Client:
 Version:      1.10.2
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   c3959b1
 Built:        Mon Feb 22 21:37:01 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.10.2
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   c3959b1
 Built:        Mon Feb 22 21:37:01 2016
 OS/Arch:      linux/amd64
vagrant@vagrant-ubuntu-tr

Output of docker info:

Containers: 5
 Running: 5
 Paused: 0
 Stopped: 0
Images: 24
Server Version: 1.10.2
Storage Driver: devicemapper
 Pool Name: docker-8:1-262711-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: ext4
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 2.007 GB
 Data Space Total: 107.4 GB
 Data Space Available: 37.2 GB
 Metadata Space Used: 4.063 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.143 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/231072.231072/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
 Metadata loop file: /var/lib/docker/231072.231072/devicemapper/devicemapper/metadata
 Library Version: 1.02.77 (2012-10-15)
Execution Driver: native-0.2
Logging Driver: json-file
Plugins: 
 Volume: local
 Network: bridge null host
Kernel Version: 3.13.0-67-generic
Operating System: Ubuntu 14.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.955 GiB
Name: vagrant-ubuntu-trusty-64
ID: XHSN:N4BF:J6HX:PVNW:GP7J:QES5:QYLN:W7YY:NFJK:4OKF:M2GH:6GHD
WARNING: No swap limit support

Provide additional environment details (AWS, VirtualBox, physical, etc.):
vagrant box ubuntu trusty, running on virtual-box 4.3.34 on mac mini OSX 10.10.5

List the steps to reproduce the issue:

  1. docker network create xyz & docker network create xyz

Describe the results you received:
network xyz is created twice:

vagrant@vagrant-ubuntu-trusty-64:~$ docker network ls
NETWORK ID          NAME                DRIVER
f0be1507dc2b        xyz                 bridge              
f091a7d18a7f        xyz                 bridge              
9bfb77c3d0c1        none                null                
fb8f222d4bb7        host                host                

Describe the results you expected:
Expected is a single network. This causes confusion with connected services.

Provide additional info you think is important:
The original issue was caused by 3 docker-compose calls that started concurrently, each launching different service in a compose file.; this causes the network to be created 3 times, and each service was on a different instance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/networkingNetworkingkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.version/1.10

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions