Source:
public CreateContainerCmd fillContainerConfig(CreateContainerCmd containerConfig) { if (hostname != null && !hostname.isEmpty()) { containerConfig.withHostName(hostname); } String[] cmd = getDockerCommandArray(); if (cmd.length > 0) containerConfig.withCmd(cmd); containerConfig.withPortSpecs("22/tcp"); if (cpuShares != null && cpuShares > 0) { containerConfig.withCpuShares(cpuShares); } if (memoryLimit != null && memoryLimit > 0) { Long memoryInByte = (long) memoryLimit * 1024 * 1024; containerConfig.withMemoryLimit(memoryInByte); } if (dnsHosts.length > 0) containerConfig.withDns(dnsHosts); if (getVolumes().length > 0) { ArrayList<Volume> vols = new ArrayList<>(); ArrayList<Bind> binds = new ArrayList<>(); for (String vol : getVolumes()) { final String[] group = vol.split(":"); if (group.length > 1) { if (group[1].equals("/")) { throw new IllegalArgumentException("Invalid bind mount: destination can't be '/'"); } binds.add(Bind.parse(vol)); } else if (vol.equals("/")) { throw new IllegalArgumentException("Invalid volume: path can't be '/'"); } else { vols.add(new Volume(vol)); } } containerConfig.withVolumes(vols.toArray(new Volume[vols.size()])); containerConfig.withBinds(binds.toArray(new Bind[binds.size()])); } if (getVolumesFrom2().length > 0) { ArrayList<VolumesFrom> volFrom = new ArrayList<>(); for (String volFromStr : getVolumesFrom2()) { volFrom.add(new VolumesFrom(volFromStr)); } containerConfig.withVolumesFrom(volFrom.toArray(new VolumesFrom[volFrom.size()])); } containerConfig.withTty(this.tty); if (environment != null && environment.length > 0) containerConfig.withEnv(environment); if (getMacAddress() != null && !getMacAddress().trim().isEmpty()) { containerConfig.withMacAddress(getMacAddress()); } return containerConfig; }

Target:
public CreateContainerCmd fillContainerConfig(CreateContainerCmd containerConfig) { if (hostname != null && !hostname.isEmpty()) { containerConfig.withHostName(hostname); } String[] cmd = getDockerCommandArray(); if (cmd.length > 0) containerConfig.withCmd(cmd); containerConfig.withPortSpecs("22/tcp"); if (cpuShares != null && cpuShares > 0) { containerConfig.withCpuShares(cpuShares); } if (memoryLimit != null && memoryLimit > 0) { Long memoryInByte = (long) memoryLimit * 1024 * 1024; containerConfig.withMemoryLimit(memoryInByte); } if (dnsHosts.length > 0) containerConfig.withDns(dnsHosts); if (getVolumes().length > 0) { ArrayList<Volume> vols = new ArrayList<>(); ArrayList<Bind> binds = new ArrayList<>(); for (String vol : getVolumes()) { final String[] group = vol.split(":"); if (group.length > 1) { if (group[1].equals("/")) { throw new IllegalArgumentException("Invalid bind mount: destination can't be '/'"); } binds.add(Bind.parse(vol)); } else if (vol.equals("/")) { throw new IllegalArgumentException("Invalid volume: path can't be '/'"); } else { vols.add(new Volume(vol)); } } containerConfig.withVolumes(vols.toArray(new Volume[vols.size()])); containerConfig.withBinds(binds.toArray(new Bind[binds.size()])); } if (getVolumesFrom2().length > 0) { ArrayList<VolumesFrom> volFrom = new ArrayList<>(); for (String volFromStr : getVolumesFrom2()) { volFrom.add(new VolumesFrom(volFromStr)); } containerConfig.withVolumesFrom(volFrom.toArray(new VolumesFrom[volFrom.size()])); } containerConfig.withTty(this.tty); if (environment != null && environment.length > 0) containerConfig.withEnv(environment); if (getMacAddress() != null) { containerConfig.withMacAddress(getMacAddress()); } return containerConfig; }