Skip to content

docker network name validation is not so strict #27449

@allencloud

Description

@allencloud

Description
As container name and volume name must be strict with regex [a-zA-Z0-9][a-zA-Z0-9_.-]. While network name is so casual that just not be empty. I think it is not so reasonable.

In addition, One confusion that why one character name for a container or volume is invalid. ping @vdemeester @vdemeester

Steps to reproduce the issue:

  1. docker network create ^, it works

Describe the results you received:
It works.

root@ubuntu:~# docker network create ^
eb995b6be7ef87ce0ed14c6a8143e7bef1aa7627ab027475df304ec96588f0fd

Describe the results you expected:

docker: Error response from daemon: Invalid network name (^), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed.

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

Output of docker version:

root@ubuntu:~# docker version
Client:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:        Thu Aug 18 05:22:43 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:        Thu Aug 18 05:22:43 2016
 OS/Arch:      linux/amd64

Output of docker info:

root@ubuntu:~# docker info
Containers: 3
 Running: 0
 Paused: 0
 Stopped: 3
Images: 63
Server Version: 1.12.1
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 455
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: overlay bridge host null
Swarm: active
 NodeID: 4yghf0i19aa9a65dgsyitqns3
 Is Manager: true
 ClusterID: 7bgsisgkf388rd3fpz5i4k71s
 Managers: 1
 Nodes: 1
 Orchestration:
  Task History Retention Limit: 10
 Raft:
  Snapshot Interval: 10000
  Heartbeat Tick: 1
  Election Tick: 3
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
 Node Address: 192.168.59.103
Runtimes: runc
Default Runtime: runc
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: HRBI:EV6M:3NAC:CXZ3:BDS7:UOKL:PD6Y:ZCK4:V3PF:V7MR:CU2Y:3LGG
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 32
 Goroutines: 118
 System Time: 2016-10-08T01:49:16.635764341+08:00
 EventsListeners: 0
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Labels:
 a=b
Insecure Registries:
 192.168.1.22:5500
 127.0.0.0/8

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancementEnhancements are not bugs or new features but can improve usability or performance.version/1.12

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions