Can A Container Retain It's Initial Docker0 IP?


I’m building a virtual lab based entirely on Docker containers using Arista’s containerized EOS (I think it’s commercial so I don’t think you can DL it). During the creation of these containers, I have to stuff a small, baseline, customized configuration into each one and then restart them. Part of that customization is allowing its management interface (in Arista speak: interface Ma0) to assume the same IP address as it’s assigned on the docker0 bridge.

This actually works fine in serial. Start a series of containers, config them, restart them… all good. They retain their assigned IP on eth0 which becomes their Ma0. No problem.

However, doing this with 25 containers or more is a slllloooooooowww process. Specially the restart. I attempted the thread the restarting with Python, and that actually sped things up significantly. But: each container was assigned a different IP than it was originally, and that screws everything up.

The ask: is there any way to have a container retain its first IP assignment, regardless of how many times it’s restarted? Only free it up if the container is removed? I’ve looked around and found nothing so far, so I’m assuming the answer is “no.”