1

I have decided to run some docker containers on my home net using a custom (user-defined) bridge interface. I gave the bridge a static IP on the same network as my docker host. The docker host's eth0 has: 192.168.10.20/24 while the docker bridge0 is configured for 192.168.10.21/24. I do not need to have docker containers talking to other docker containers. I want each container to run a service on its own IP address, accessible to any host on my 192.168.10.0/24 network. What is the simplest way to accomplish this? Using CentOS 7.6.1810, docker 18.09.0, build 4d60db4.

Also, do the cool kids use /etc/docker/daemon.json or /etc/sysconfig/docker to control settings? Not sure if using systemd is the best option for docker.

mr.zog
  • 923
  • 3
  • 20
  • 39

2 Answers2

1

You do not want a bridge defined with the same subnet as your host ethernet. Linux will not know which network to send packets to since they both have the same routing entry. If you really need separate IP addresses for containers (this is a very non-traditional configuration), then you want macvlan or ipvlan.

Note that using host networking will expose all host interfaces to the container, which many consider a security risk. Containers running with this setting have the same network access as a process running outside of a container.

BMitch
  • 5,966
  • 1
  • 25
  • 32
0

There was no need to modify the default docker network stack. All I needed was to specify the host network ( --net=host ) to make the listener available to my LAN. docker run -d --net=host --name { container_name } { options }

mr.zog
  • 923
  • 3
  • 20
  • 39