Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I attach a user-defined "bridge" network to a network interface on Docker host with command "docker network" ? #21058

Closed
immarvin opened this issue Mar 9, 2016 · 4 comments

Comments

@immarvin
Copy link

immarvin commented Mar 9, 2016

Output of docker version:

[root@c910f05c01bc07 ~]# docker version
Client:
 Version:      1.10.2
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   c3959b1
 Built:        Mon Feb 22 16:16:33 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 16:16:33 2016
 OS/Arch:      linux/amd64

Output of docker info:

[root@c910f05c01bc07 ~]# docker info
Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 25
Server Version: 1.10.2
Storage Driver: devicemapper
 Pool Name: docker-253:0-270740719-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 8.762 GB
 Data Space Total: 107.4 GB
 Data Space Available: 98.61 GB
 Metadata Space Used: 7.782 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.14 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/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/devicemapper/devicemapper/metadata
 Library Version: 1.02.107-RHEL7 (2015-12-01)
Execution Driver: native-0.2
Logging Driver: json-file
Plugins: 
 Volume: local
 Network: null host bridge
Kernel Version: 3.10.0-327.el7.x86_64
Operating System: Red Hat Enterprise Linux Server 7.2 (Maipo)
OSType: linux
Architecture: x86_64
CPUs: 32
Total Memory: 46.98 GiB
Name: c910f05c01bc07.cluster.com
ID: PN3C:DWFL:HRA3:M2Z2:BO4V:4IWC:PGVV:DG3U:MYI7:O2XW:BBBY:4S2E
Username: immarvin
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

Provide additional environment details (AWS, VirtualBox, physical, etc.):

phisical x86_64 machine

List the steps to reproduce the issue:

To create a bridge network attached to a network interface on docker host, I have to try the following 3 steps

1.docker network create --driver=bridge --gateway=10.5.107.1 --subnet=10.5.107.0/8 --ip-range=10.5.107.100/30 -o "com.docker.network.bridge.name"="br0" -o "com.docker.network.bridge.host_binding_ipv4"="10.5.107.1" subnet1
2.;ip addr del dev eno1 10.5.107.1/8
3.;brctl addif br0 eno1
4.ip link set br0 up

is it possible to finish the 3 steps above in 1 "docker network" command? is there any option to achieve this?

Describe the results you received:

NA

Describe the results you expected:

create a user defined bridge network and attach it to a network interface on docker host with one "docker network create"

Provide additional info you think is important:

I am trying to dockerize my project and encourage users to use run my service inside docker container instead of traditional installation way, I have finished the docker image build and draft a documentation(http://10.3.5.21/doc/advanced/docker/run_xcat_in_docker.html) to run it in docker, I encountered some problem while trying to start container with docker compose instead of following the doc step-by-step, since I can not include the following 2,3,4 steps in the docker-compose.yml:

1.docker network create --driver=bridge --gateway=10.5.107.1 --subnet=10.5.107.0/8 --ip-range=10.5.107.100/30 -o "com.docker.network.bridge.name"="br0" -o "com.docker.network.bridge.host_binding_ipv4"="10.5.107.1" subnet1
2.;ip addr del dev eno1 10.5.107.1/8
3.;brctl addif br0 eno1
4.ip link set br0 up
@aboch
Copy link
Contributor

aboch commented Mar 9, 2016

is it possible to finish the 3 steps above in 1 "docker network" command? is there any option to achieve this?

It is not possible today.

It could be done. We could tell the bridge driver to perform the required plumbing via driver specific options. I was in fact suggesting this approach in #20758 (comment).

Feel free to open a request in libnetwork. [edited]

@immarvin
Copy link
Author

hi @aboch , thanks for your advice.

I opened a feature request to docker/libnetwork moby/libnetwork#1003

I will try the approach in the thread you mentioned

@thaJeztah
Copy link
Member

Thanks @immarvin, I'll close the issue here now that we have moby/libnetwork#1003 to track this

@immarvin
Copy link
Author

hi @thaJeztah ,thanks.

seems the docker/libnetwork community is not as active as here....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants