use of org.eclipse.jkube.kit.build.service.docker.access.ContainerHostConfig in project jkube by eclipse.
the class RunService method createContainerHostConfig.
ContainerHostConfig createContainerHostConfig(RunImageConfiguration runConfig, PortMapping mappedPorts, File baseDir) throws DockerAccessException {
RestartPolicy restartPolicy = runConfig.getRestartPolicy();
List<String> links = findContainerIdsForLinks(runConfig.getLinks(), runConfig.getNetworkingConfig().isCustomNetwork());
ContainerHostConfig config = new ContainerHostConfig().extraHosts(runConfig.getExtraHosts()).links(links).portBindings(mappedPorts).privileged(runConfig.getPrivileged()).shmSize(runConfig.getShmSize()).dns(runConfig.getDns()).dnsSearch(runConfig.getDnsSearch()).capAdd(runConfig.getCapAdd()).capDrop(runConfig.getCapDrop()).securityOpts(runConfig.getSecurityOpts()).memory(runConfig.getMemory()).memorySwap(runConfig.getMemorySwap()).restartPolicy(restartPolicy.getName(), restartPolicy.getRetry()).logConfig(runConfig.getLog()).tmpfs(runConfig.getTmpfs()).ulimits(runConfig.getUlimits()).cpuShares(runConfig.getCpuShares()).cpus(runConfig.getCpus()).cpuSet(runConfig.getCpuSet()).readonlyRootfs(runConfig.getReadOnly()).autoRemove(runConfig.getAutoRemove());
addVolumeConfig(config, runConfig, baseDir);
addNetworkingConfig(config, runConfig);
return config;
}
Aggregations