Source:
private String createContainer(String workspaceId, String machineName, boolean isDev, String image, String networkName, CheServiceImpl service) throws IOException { long machineMemorySwap = memorySwapMultiplier == -1 ? -1 : (long)(service.getMemLimit() * memorySwapMultiplier); addSystemWideContainerSettings(workspaceId, isDev, service); EndpointConfig endpointConfig = new EndpointConfig().withAliases(machineName) .withLinks(toArrayIfNotNull(service.getLinks())); NetworkingConfig networkingConfig = new NetworkingConfig().withEndpointsConfig(singletonMap(networkName, endpointConfig)); HostConfig hostConfig = new HostConfig(); hostConfig.withBinds(toArrayIfNotNull(service.getVolumes())) .withExtraHosts(allMachinesExtraHosts) .withPublishAllPorts(true) .withMemorySwap(machineMemorySwap) .withMemory(service.getMemLimit()) .withPrivileged(privilegeMode) .withPidsLimit(pidsLimit) .withNetworkMode(networkName) .withLinks(toArrayIfNotNull(service.getLinks())) .withPortBindings(service.getPorts() .stream() .collect(toMap(Function.identity(), value -> new PortBinding[0]))) .withVolumesFrom(toArrayIfNotNull(service.getVolumesFrom())); if (volumesFromContainerName != null) { hostConfig.withVolumesFrom(new String[] { volumesFromContainerName }); } ContainerConfig config = new ContainerConfig(); config.withImage(image) .withExposedPorts(service.getExpose() .stream() .distinct() .collect(toMap(Function.identity(), value -> emptyMap()))) .withHostConfig(hostConfig) .withCmd(toArrayIfNotNull(service.getCommand())) .withEntrypoint(toArrayIfNotNull(service.getEntrypoint())) .withLabels(service.getLabels()) .withNetworkingConfig(networkingConfig) .withEnv(service.getEnvironment() .entrySet() .stream() .map(entry -> entry.getKey() + "=" + entry.getValue()) .toArray(String[]::new)); return docker.createContainer(CreateContainerParams.create(config) .withContainerName(service.getContainerName())) .getId(); }

Target:
private String createContainer(String workspaceId, String machineName, boolean isDev, String image, String networkName, CheServiceImpl service) throws IOException { long machineMemorySwap = memorySwapMultiplier == -1 ? -1 : (long)(service.getMemLimit() * memorySwapMultiplier); addSystemWideContainerSettings(workspaceId, isDev, service); EndpointConfig endpointConfig = new EndpointConfig().withAliases(machineName) .withLinks(toArrayIfNotNull(service.getLinks())); NetworkingConfig networkingConfig = new NetworkingConfig().withEndpointsConfig(singletonMap(networkName, endpointConfig)); HostConfig hostConfig = new HostConfig(); hostConfig.withBinds(toArrayIfNotNull(service.getVolumes())) .withMemorySwap(machineMemorySwap) .withMemory(service.getMemLimit()) .withNetworkMode(networkName) .withLinks(toArrayIfNotNull(service.getLinks())) .withPortBindings(service.getPorts() .stream() .collect(toMap(Function.identity(), value -> new PortBinding[0]))) .withVolumesFrom(toArrayIfNotNull(service.getVolumesFrom())); ContainerConfig config = new ContainerConfig(); config.withImage(image) .withExposedPorts(service.getExpose() .stream() .distinct() .collect(toMap(Function.identity(), value -> emptyMap()))) .withHostConfig(hostConfig) .withCmd(toArrayIfNotNull(service.getCommand())) .withEntrypoint(toArrayIfNotNull(service.getEntrypoint())) .withLabels(service.getLabels()) .withNetworkingConfig(networkingConfig) .withEnv(service.getEnvironment() .entrySet() .stream() .map(entry -> entry.getKey() + "=" + entry.getValue()) .toArray(String[]::new)); addStaticDockerConfiguration(config); return docker.createContainer(CreateContainerParams.create(config) .withContainerName(service.getContainerName())) .getId(); }