-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Method of exposing UDP port changed in 1.16.0 #4667
Comments
I believe this is also related to issue #4489 |
It looks like this broke because Here is a sample of what I needed to do to work around this: GenericContainer container = new GenericContainer<>(image)
.withExposedPorts(8080, 8081)
.withCreateContainerCmdModifier(cmd -> {
//Add previously exposed ports and UDP port
List<ExposedPort> exposedPorts = new ArrayList<>();
for (ExposedPort p : cmd.getExposedPorts()) {
exposedPorts.add(p);
}
exposedPorts.add(ExposedPort.udp(99));
cmd.withExposedPorts(exposedPorts);
//Add previous port bindings and UDP port binding
Ports ports = cmd.getPortBindings();
ports.bind(ExposedPort.udp(99), Ports.Binding.empty());
cmd.withPortBindings(ports);
} |
Putting "wontfix" here because it isn't a breaking change but an assumption that got changed. We never guaranteed that we will bind ports that were added through |
Closing this issue as no work needs to be done to fix this, just a code change on the user's part. Keeping associated PR open just in case the maintainers want to add this as a test case to prevent future regression testing. |
Thanks @KyleAure, your help is much appreciated 🙌 |
I am upgrading from:
TestContainers 1.15.3 -> 1.16.2
Docker-Java 3.2.8 -> 3.2.12
In order to expose a UDP port, users are required to access the underlying docker-java command, and modify it to expose the desired port. In my project I am doing this using a custom container class and overwriting the
configure()
method as follows:Once the container is started, I try to extract the mapped port using the
InspectContainerResponse
object as follows:A NullPointerException is thrown because the
withCreateContainerCmdModifier
was not honored.This is apparent when inspecting the container created directly with docker:
And printing out the contents of the bindings map at runtime
The text was updated successfully, but these errors were encountered: