docker / for-linux

Docker Engine for Linux
https://docs.docker.com/engine/installation/
754 stars 85 forks source link

Can't bind swarm docker_gwbridge to specific IP #793

Open timotheencl opened 5 years ago

timotheencl commented 5 years ago

I my Swarm cluster I've multiple network interfaces, one for the control back plane and other one for the public traffic. I would like that the docker_gwbridg listen only on the public interface, not on all interfaces.

Expected behavior

When I remove and recreate the docker_gwbridge with the host_binding_ipv4 option:

--opt "com.docker.network.bridge.host_binding_ipv4"="192.168.0.1"

I would expect to get the docker bridge listen only on the interface I specified (192.168.0.1)

Actual behavior

But the actual behavior is that the bridge listen on all network interfaces:

Output of netstat command indicate that the dockerd process listen on a tcp6 socket :::80

Steps to reproduce the behavior

I first leave the swarm cluster.

Next I remove the current docker_gwbridge network bridge.

Then I recreate it with the --opt "com.docker.network.bridge.host_binding_ipv4"="192.168.0.1"

Finnaly I re-join the swarm cluster.

The services spawn in the node but are listening on all network interfaces

How could I make docker swarm listen on a specific network interface ?

Thanks

Output of docker version:

Client: Docker Engine - Community
 Version:           19.03.2
 API version:       1.40
 Go version:        go1.12.8
 Git commit:        6a30dfc
 Built:             Thu Aug 29 05:29:11 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.2
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.8
  Git commit:       6a30dfc
  Built:            Thu Aug 29 05:27:45 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info:

Client:
 Debug Mode: false

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 2
 Server Version: 19.03.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: active
  NodeID: m3h71ge4bsm5vyriljnjptghb
  Is Manager: true
  ClusterID: 68ho7h0m27twj9cp3rksauhm1
  Managers: 3
  Nodes: 5
  Default Address Pool: 10.0.0.0/8  
  SubnetSize: 24
  Data Path Port: 4789
  Orchestration:
   Task History Retention Limit: 5
  Raft:
   Snapshot Interval: 10000
   Number of Old Snapshots to Retain: 0
   Heartbeat Tick: 1
   Election Tick: 10
  Dispatcher:
   Heartbeat Period: 5 seconds
  CA Configuration:
   Expiry Duration: 3 months
   Force Rotate: 0
  Autolock Managers: false
  Root Rotation In Progress: false
  Node Address: 10.10.10.1
  Manager Addresses:
   192.168.0.1:2377
   192.168.0.2:2377
   192.168.0.3:2377
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 4.15.0-64-generic
 Operating System: Ubuntu 18.04.3 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 31.29GiB
 Name: xx i_removed_sensitive_info xx
 ID: R5PS:NCGZ:4UPZ:4OOC:737S:IXER:Y2GM:YZLN:Z5VM:YM5N:5SGB:ZSY3
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Docker 19 on Ubuntu 18.04 on physical machines

smeana commented 2 years ago

@timotheenicolas did you managed to solve this?