I have done the following
Steps to reproduce
If you create containers and then delete them with --force, it seems to leak IP addresses. Eventually you will reach a state where you can't create a new container, with the error "no free indices are available for allocation". Looking through the code, I found this comes from the IP address allocation logic.
I wrote a test script that will create a simple container and then container delete --force it in a loop. You can find it here:
https://gist.github.com/thomasjm/6a2d60e3233fa55bc7765c2426784b33#file-test_ip_exhaustion-sh
There's also another version that does a graceful shutdown, calling container stop and waiting for the container to fully stop before deleting it:
https://gist.github.com/thomasjm/6a2d60e3233fa55bc7765c2426784b33#file-test_ip_exhaustion_graceful-sh
Current behavior
Running the first script will eventually start generating failures after about ~255 iterations. (Because the default system subnet is a /24, so that's how many IP addresses are available.)
...
ip-leak-test-263
[263] ip-leak-test-263 -> 192.168.64.180/24
ip-leak-test-264
[264] ip-leak-test-264 -> 192.168.64.191/24
ip-leak-test-265
[265] ip-leak-test-265 -> 192.168.64.242/24
FAILED at iteration 266: Error: failed to bootstrap container (cause: "unknown: "no free indices are available for allocation"")
Running the graceful shutdown version of the script does not result in failures.
Expected behavior
IP addresses shouldn't leak; creating a container should always succeed if there are <255 currently running containers. (Or whatever the size of the default subnet is.)
Environment
- OS: Version 26.3.1 (a) (25D771280a)
- Xcode:
- Container: container CLI version 0.10.0 (build: release, commit: 6bdb647)
Relevant log output
Code of Conduct
I have done the following
Steps to reproduce
If you create containers and then delete them with
--force, it seems to leak IP addresses. Eventually you will reach a state where you can't create a new container, with the error "no free indices are available for allocation". Looking through the code, I found this comes from the IP address allocation logic.I wrote a test script that will create a simple container and then
container delete --forceit in a loop. You can find it here:https://gist.github.com/thomasjm/6a2d60e3233fa55bc7765c2426784b33#file-test_ip_exhaustion-sh
There's also another version that does a graceful shutdown, calling
container stopand waiting for the container to fully stop before deleting it:https://gist.github.com/thomasjm/6a2d60e3233fa55bc7765c2426784b33#file-test_ip_exhaustion_graceful-sh
Current behavior
Running the first script will eventually start generating failures after about ~255 iterations. (Because the default system subnet is a /24, so that's how many IP addresses are available.)
Running the graceful shutdown version of the script does not result in failures.
Expected behavior
IP addresses shouldn't leak; creating a container should always succeed if there are <255 currently running containers. (Or whatever the size of the default subnet is.)
Environment
Relevant log output
Code of Conduct