The getContainerIpAddress() method may return "localhost", which is not an IP address (it indirectly calls the DockerClientProviderStrategy#resolveDockerHostIpAddress() method, which uses "localhost" as a fallback value for a couple of cases). The javadoc says @return an IP address and doesn't mention that the method can return non-IP values at all.
Also see open-telemetry/opentelemetry-java-instrumentation#4745