Add getMappedPort(Integer originalPort, InternetProtocol protocol)

Author: npetzallCreated Jan 23, 2018Updated Sep 18, 2026
Labelstype/featureresolution/acknowledgedgood first issue

It will just look so much nicer in my test than

genericContainer.getContainerInfo().getNetworkSettings().getPorts().getBindings().get(new ExposedPort(originalPort, protocol))[0].getHostPortSpec()

I think it has something to do with the law of demeter.

But in all fairness root cause is https://github.com/moby/moby/issues/4635

Source: testcontainers/testcontainers-java