feat: allow setting custom IP address for container #587
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this PR adds option to specify custom IP for a container
some prerequisites are needed, but those are regular as with doing the same with docker or docker compose
this is possible to use only when using user defined subnets, but error message is quite clear if anyone tries to use it without.
reason why i need this feature is quite simple:
I have some complex tests where I need to know in advance IP addressees of some containers before starting anything.
However I can only do that currently by starting the containers, getting the IPs of all containers, stopping it, clearing data, setting all IPs in configs of multiple containers and then start containers again and proceed with test
so the test itself can be much simpler if I can define all addresses in advance, create configs, build containers with already known IPs and just focus on actual testing of a feature.
Reason why IP needs to be fixed (and not hostname or some discovery ) is due to protocols used and for example security (and I do something similar not only in tests)
Also its much easier to set the "wrong" IP and test implementation where security is good enough to not allow that.
I also added test where i test both creating container in custom subnet + creating container with custom IP (for test is just next available IP) in same network.