In my Linux network I am unable to reach my docker containers from the host they are running on, over a dedicated macvlan network. All other connections from to this macvlan network are fine.
So basically the setup is:
DOCKER1 eth0 172.0.0.1 (default)
| eth1 10.0.0.1 (macvlan)
CONTAINER1 10.0.0.11 (macvlan)
DOCKER2 eth0 172.0.0.2 (default)
| eth1 10.0.0.2 (macvlan)
CONTAINER2 10.0.0.12 (macvlan)
How can I make the host reach itss own containers over the macvlan network?
I need specific applications to interact over this network, so using docker exec
won't solve my problem ;).
You can do this by doing the following:
ip link add foobar link enp7s0 type macvlan mode bridge
ip addr add 192.168.9.252/32 dev foobar
ip link set foobar up
ip route add 192.168.9.228/32 dev foobar
Where:
enp7s0 - Name of your physical adapter
192.168.9.252/32 - Genuine new IP on your network
192.168.9.228/32 - IP of the container using macvlan
Please be aware that this will not survive reboots, so you will need to script it to run each reboot or use another method to make it persisten
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With