Your result is interesting, but it doesn’t invalidate the behavior of --ip-range. As mentioned earlier, --ip-range is used for Docker’s built-in DHCP allocation and does not restrict manually assigned static IPs or the first allocated address in certain cases, especially in macvlan networks where behavior differs slightly from bridge networks.
However, there are a few things to consider:
Docker’s Allocation Strategy Can Differ by Version and Network Driver. On some setups, Docker might still allocate the first available IP in the subnet (.96 in your case) before honoring the --ip-range setting.
Macvlan operates differently than bridge networking, where --ip-range is more strictly followed for dynamic assignments.
The First Assigned Address Can Fall Outside --ip-range depending on implementation. This might be an inconsistency in how Docker CE 24.02 handles macvlan specifically. With bridge networks, Docker tends to follow --ip-range more reliably.
Try Running Multiple Containers. If you spin up multiple containers, do subsequent ones get allocated within 192.168.200.100-109 as expected?
This would confirm whether Docker eventually adheres to the defined range after the initial assignment.
Docker Might Allocate from the First Free Address in the Subnet. In some versions, Docker will assign the first available IP in the subnet if no prior allocations exist, instead of immediately enforcing the --ip-range.
While your example shows .96 being assigned, that doesn’t necessarily mean --ip-range is ignored—it may simply be a quirk of macvlan’s handling of initial IP assignments. Testing with multiple containers should clarify whether Docker eventually follows the defined range for subsequent allocations.
Also, if using Docker’s --ip-range option, you’d need to use a CIDR notation block or a single contiguous block as the comma-separated option is not valid when using the --ip-range option. I may have incorrectly added that in an earlier comment while reviewing. That’s why --ip-range=192.168.200.100,192.168.200.101 fails, while something like --ip-range=192.168.200.100/30 (which includes .100 and .101) would work.
So in a nutshell, understanding how different versions and individual docker setups function with networking would be a deciding factor in the results either of you are trying to achieve. It seems as though this is more of a debate rather than trying to understand how networking works in general. I’m just trying to help. I hope this clarifies things a little more.