Can’t create Docker network with none matching gateway

  docker, docker-networking, gateway, macvlan

I have a bare metal server on Hetzner with IP 5.6.7.8 and 8 additional IPs reserved for me.

IPs: 1.2.3.144 to 1.2.3.151

subnet: 1.2.3.144/29

netmask: 255.255.255.248

broadcast: 1.2.3.151

gateway: 5.6.7.8

Now I want to create Docker network with type macvlan

docker network create macvlan --subnet=1.2.3.144/29 --gateway=5.6.7.8 -o parent=enp0s31f6 macvlan1

But this command causes an error

no matching subnet for gateway 5.6.7.8

Note when I set for example IP 1.2.3.150 and gateway 5.6.7.8 on a virtual machine on the host, it works correctly! but I can’t set this none matching gateway in Docker network create command.

Source: StackOverflow

LEAVE A COMMENT