I'm working on a Docker setup that involves creating multiple networks. Here's my scenario: I have Network A and Network B. I want the containers in Network B to have static IPs assigned to them, and I need Network B to communicate with Network A as well as the external network. Additionally, Network A should be accessible by both the external world and Network B. I've found that ipvlan can support static IPs, but I'm struggling to create multiple networks on the same parent interface. However, macvlan doesn't strictly adhere to static IP rules. What do you think is the best solution for this?
2 Answers
If your host has a static IP, that can simplify things. Most of the time, using DNS instead of IPs can reduce the headache of managing container networks. Instead of stressing over static IPs for your containers, consider treating them like cattle rather than pets. This could save you a lot of time and effort!
It sounds like you might be overcomplicating things a bit! If you’re trying to set static IPs in Docker, it might be worth asking yourself why. Usually, Docker is great for dynamic IP handling. Could you explain what your end goal is? You might find that there’s an easier way to achieve what you’re trying to do.

I'm trying to simulate data from IoT devices to a server. Each device needs its own IP address, and I want to replicate that configuration.