docker-net-dhcp icon indicating copy to clipboard operation
docker-net-dhcp copied to clipboard

Support 'gateway' option when creating network

Open Vigilans opened this issue 3 years ago • 0 comments

When using docker to build an intermediate gateway (like raspberry pi), we may expect a following workflow:

  • Set DHCP server's published default gateway to be intermediate gateway's LAN IP;
  • Set intermediate gateway (the docker container)'s default gateway to be router's LAN IP.

However, currently docker-net-dhcp will always use DHCP published gateway when creating the container, and when that published IP is the same as container's lease IP, an error Destination unreachable will raise, preventing us to modify the gateway later after the container created.

Thus, this PR add a new option gateway when creating the docker network, to forcibly uses a user-provided gateway instead of one provided by DHCP when creating the container.

Usage example: docker create .... -o bridge=br-eth -o gateway=192.168.0.2

Vigilans avatar Aug 29 '22 14:08 Vigilans