private Iterable<String> getPrivateIpAddresses(Container container) { // A container can be attached to multiple networks. It can therefore have multiple private // IPs. The NetworkSettings.ipAddress might in fact be blank, with the only IP being on // network objects. if (container.networkSettings() == null) return ImmutableList.of(); ImmutableSet.Builder<String> builder = ImmutableSet.<String>builder(); NetworkSettings settings = container.networkSettings(); if (settings.ipAddress() != null && settings.ipAddress().length() > 0) { builder.add(settings.ipAddress()); } if (settings.networks() != null) { for (Map.Entry<String, NetworkSettings.Details> entry : settings.networks().entrySet()) { String ipAddress = entry.getValue().ipAddress(); if (ipAddress != null && ipAddress.length() > 0) { builder.add(ipAddress); } } } return builder.build(); }
private Iterable<String> getPrivateIpAddresses(Container container) { // A container can be attached to multiple networks. It can therefore have multiple private // IPs. The NetworkSettings.ipAddress might in fact be blank, with the only IP being on // network objects. if (container.networkSettings() == null) return ImmutableList.of(); ImmutableSet.Builder<String> builder = ImmutableSet.<String>builder(); NetworkSettings settings = container.networkSettings(); if (settings.ipAddress() != null && settings.ipAddress().length() > 0) { builder.add(settings.ipAddress()); } if (settings.networks() != null) { for (Map.Entry<String, NetworkSettings.Details> entry : settings.networks().entrySet()) { String ipAddress = entry.getValue().ipAddress(); if (ipAddress != null && ipAddress.length() > 0) { builder.add(ipAddress); } } } return builder.build(); }
private Iterable<String> getPrivateIpAddresses(Container container) { // A container can be attached to multiple networks. It can therefore have multiple private // IPs. The NetworkSettings.ipAddress might in fact be blank, with the only IP being on // network objects. if (container.networkSettings() == null) return ImmutableList.of(); ImmutableSet.Builder<String> builder = ImmutableSet.<String>builder(); NetworkSettings settings = container.networkSettings(); if (settings.ipAddress() != null && settings.ipAddress().length() > 0) { builder.add(settings.ipAddress()); } if (settings.networks() != null) { for (Map.Entry<String, NetworkSettings.Details> entry : settings.networks().entrySet()) { String ipAddress = entry.getValue().ipAddress(); if (ipAddress != null && ipAddress.length() > 0) { builder.add(ipAddress); } } } return builder.build(); }
private Iterable<String> getPrivateIpAddresses(Container container) { // A container can be attached to multiple networks. It can therefore have multiple private // IPs. The NetworkSettings.ipAddress might in fact be blank, with the only IP being on // network objects. if (container.networkSettings() == null) return ImmutableList.of(); ImmutableSet.Builder<String> builder = ImmutableSet.<String>builder(); NetworkSettings settings = container.networkSettings(); if (settings.ipAddress() != null && settings.ipAddress().length() > 0) { builder.add(settings.ipAddress()); } if (settings.networks() != null) { for (Map.Entry<String, NetworkSettings.Details> entry : settings.networks().entrySet()) { String ipAddress = entry.getValue().ipAddress(); if (ipAddress != null && ipAddress.length() > 0) { builder.add(ipAddress); } } } return builder.build(); }