docker-cli network_mode should default to host if bridge does not exist
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
Description
There are a few enterprises that do not allow ip_forward or bridge networking. On dockerd the default bridge network can be disabled by setting it to none --bridge=none. When the bridge networking is not present, the cli should use host network by default. The only workaround right now is to pass --net=host every time you run the client but unfortunately there is no way to enforce this globally and there is no solution to make net=host option work with a multi-stage build compose file.
Steps to reproduce the issue:
- docker run -it alpine ash
Describe the results you received:
WARNING: IPv4 forwarding is disabled. Networking will not work.
/ #
Describe the results you expected:
No warning and using net=host
Additional information you deem important (e.g. issue happens only occasionally):
Output of docker version:
Client:
Version: 1.13.1-cs9
API version: 1.27
Go version: go1.7.5
Git commit: 1bc62a2
Built: Wed Dec 13 20:56:37 2017
OS/Arch: linux/amd64
Server:
Version: 1.13.1-cs9
API version: 1.27 (minimum version 1.12)
Go version: go1.7.5
Git commit: 1bc62a2
Built: Wed Dec 13 20:56:37 2017
OS/Arch: linux/amd64
Experimental: false
Output of docker info:
Containers: 28
Running: 1
Paused: 0
Stopped: 27
Images: 10
Server Version: 1.13.1-cs9
Storage Driver: overlay
Backing Filesystem: xfs
Supports d_type: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 6c463891b1ad274d505ae3bb738e530d1df2b3c7
runc version: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-693.21.1.el7.x86_64
Operating System: Red Hat Enterprise Linux Server 7.4 (Maipo)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.51 GiB
Name: xxx-XXXXX.xxxx.xxx
ID: 2AWA:IH6P:DNWO:GWJD:273C:CEXN:KHYH:SZS7:E4NK:HBOP:W5QA:LBUY
Docker Root Dir: /app/var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Http Proxy: http://XXXXX:XXXX@XXXX.XXXX.XXXX:8080
Https Proxy: http://XXXXX:XXXX@XXXX.XXXX.XXXX:8080
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: IPv4 forwarding is disabled
Additional environment details (AWS, VirtualBox, physical, etc.):
There is no docker0 network:
docker network ls
NETWORK ID NAME DRIVER SCOPE
f13483c9bbb4 host host local
fa5836204847 none null local
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the docker run network-option handling and examine how the CLI behaves when the bridge network is absent. Reproduce the issue with only host and none networks, then verify that docker run -it alpine ash selects host networking without the IPv4-forwarding warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli, networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100