Behavorial difference in IP allocation between Podman and Docker #644
Replies: 2 comments 3 replies
-
@Luap99 @flouthoc thoughts? I know this is working as designed ... but the question/observation seems fair enough. |
Beta Was this translation helpful? Give feedback.
-
I never have thought about it but the default TLL seems way to high. AFAIK most dns clients will not cache dns records at all so that's why we haven't seen this come up yet. IMO we can lower the TTL to 60 which should help because even when we try to reuse the IP there will be cases were reuse is not possible. As for the IP resuse part I simply implemented the IPAM in the most simple manner, we can change it but it doesn't look like a trivial change and I don't see this as a priority. |
Beta Was this translation helpful? Give feedback.
-
This may become irrelevant whenever Netavark supports
--ipam-driver dhcp
- but I wanted to ask anyway.After migrating to Podman, I started to see issues with containers on my network having stale DNS records cached - apparently, when containers are either restarted/recreated - Podman (Netavark?) will more aggressively assign new IPs than what I'm used to in Docker.
I know that the proper answer is to statically assign IPs to each container - but I just wanted to point out this difference, because it may be troublesome for people making the migration.
I'll also preface by saying that I don't think either behavior is technically incorrect - I actually like Podman's behavior more - but the consequence is the stale cached DNS records, and with Aardvark's TTL of 86400, that can mean containers won't know about another container's new IP until at most a day later.
Podman
Docker
I don't think Docker is doing MAC-based DHCP leases. Based on above, in Docker, you can create and and destroy a container - which will assign a new MAC to it - but Docker will still (most of the time) reassign its old IP to it. If it sees
172.18.0.2
was assigned previously, but is no longer in use, it prefers to use that before using172.18.0.3
.It feels like Docker's IPAM will prefer to be conservative and reuse deallocated and not-in-use IPs, before moving on to ones that have never been allocated. Netavark doesn't.
This isn't a leak in IPAM - Netavark allows assigning a static IP that was previously assigned and not in use - but it won't assign those IPs again on its own until the range pool is depleted.
There was some discussion a long time ago about IP stability in Docker - moby/moby#2801 - some of the concerns about aggressively assigning new IPs were mentioned there with regards to DNS.
If this is intended behavior, I guess I'll go over to Aardvark and ask for configurable TTLs - I think 1 day is too high to not be configurable.
Beta Was this translation helpful? Give feedback.
All reactions