Skip to content

daemon allows creating two network with same name when checkDuplicate is false, REASONABLE? #30242

@allencloud

Description

@allencloud

Description

Hi, All,

I found that we could create two bridge networks with same name, as we use a field "checkDuplicate":false, in the api request payload.

Is it reasonable?

Here is my request:

POST 192.168.59.103:2375/networks/create
payload:
{
	"Name":"ouyang",
	"Driver":"bridge",
	"EnableIPv6":false,
	"Internal":false,
	"Attachable":false,
	"Options":{},
	"checkDuplicate":false,
	"Labels":{},
	"IPAM":{
		"Driver":"default",
		"Options":{},
		"Config":[]
	}
}

With the first create request, we got the response:

{
  "Id":"1c4fcb3e1e9b3a25aa04164328a6d680bab897e151dbc09a0c8e3d414e22a0bc",
  "Warning": ""
}

With the first create request, we got the response:

{
  "Id": "1c4fcb3e1e9b3a25aa04164328a6d680bab897e151dbc09a0c8e3d414e22a0bc",
  "Warning": "Network with name ouyang (id : 77ab41fbbe321bc02622b50d81ef2404b3229a8d8a53aeb8922f762b9d15ec9f) already exists"
}

We create twice, and get result like this:

root@ubuntu:~# docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
30d1f8c9ec34        bridge              bridge              local
85ded5476b05        docker_gwbridge     bridge              local
d909a9f88b4c        host                host                local
f799odklwkfi        ingress             overlay             swarm
615a39ff6c47        none                null                local
77ab41fbbe32        ouyang              bridge              local
1c4fcb3e1e9b        ouyang              bridge              local

Two network ouyang, is it reasonable? Since it happens, we could not use docker network inspect ouyang and some other network commands using network name:

  1. docker network inspect ouyang may get the wrong network;
  2. docker network rm ouyang may remove the wrong network;
  3. .....

Or it is for some kind of back compatibility? If that, I think we should mark that in the source code.

Describe the results you received:

Describe the results you expected:

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

root@ubuntu:~# docker version
Client:
 Version:      1.13.0-rc4
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   88862e7
 Built:        Fri Dec 16 22:59:15 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.13.0-rc4
 API version:  1.25 (minimum version 1.12)
 Go version:   go1.7.3
 Git commit:   88862e7
 Built:        Fri Dec 16 22:59:15 2016
 OS/Arch:      linux/amd64
 Experimental: false
root@ubuntu:~#

Output of docker info:

root@ubuntu:~# docker info
Containers: 8
 Running: 6
 Paused: 0
 Stopped: 2
Images: 37
Server Version: 1.13.0-rc4
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 202
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: active
 NodeID: 07jqxh286upar2z13e9cf69ad
 Is Manager: true
 ClusterID: vkawf2iglgltjxyupnvpbst5f
 Managers: 1
 Nodes: 1
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 3
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
 Node Address: 192.168.59.103
 Manager Addresses:
  192.168.59.103:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 03e5862ec0d8d3b3f750e19fca3ee367e13c090e
runc version: 51371867a01c467f08af739783b8beafc154c4d7
init version: 949e6fa
Security Options:
 apparmor
Kernel Version: 3.19.0-25-generic
Operating System: Ubuntu 14.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.954 GiB
Name: ubuntu
ID: Q2ZC:GWDN:27OH:GRMH:G6QU:W7QP:4TIX:Q5F6:YEVK:45XP:EXHC:HOB5
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 90
 Goroutines: 184
 System Time: 2017-01-17T14:45:33.364813219+08:00
 EventsListeners: 0
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Experimental: false
Insecure Registries:
 127.0.0.0/8
Registry Mirrors:
 https://a.b.c/
Live Restore Enabled: false

Additional environment details (AWS, VirtualBox, physical, etc.):

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.13

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions