@Test public void testHostConfig() throws Exception { final TaskConfig taskConfig = TaskConfig.builder() .namespace("test") .host(HOST) .job(JOB) .build(); final HostConfig hostConfig = taskConfig.hostConfig(Optional.absent()); assertThat(ImmutableSet.copyOf(hostConfig.capAdd()), equalTo(CAP_ADDS)); assertThat(ImmutableSet.copyOf(hostConfig.capDrop()), equalTo(CAP_DROPS)); }
public HostConfig hostConfig(final Optional<String> dockerVersion) { final List<String> securityOpt = job.getSecurityOpt(); final HostConfig.Builder builder = HostConfig.builder() .binds(binds()) .portBindings(portBindings()) .dns(dns) .securityOpt(securityOpt.toArray(new String[securityOpt.size()])) .runtime(job.getRuntime()) .networkMode(job.getNetworkMode()); if (!job.getRamdisks().isEmpty()) { builder.tmpfs(job.getRamdisks()); } final Resources resources = job.getResources(); if (resources != null) { builder.memory(resources.getMemory()); builder.memorySwap(resources.getMemorySwap()); builder.cpusetCpus(resources.getCpuset()); builder.cpuShares(resources.getCpuShares()); } builder.capAdd(ImmutableList.copyOf(job.getAddCapabilities())); builder.capDrop(ImmutableList.copyOf(job.getDropCapabilities())); for (final ContainerDecorator decorator : containerDecorators) { decorator.decorateHostConfig(job, dockerVersion, builder); } return builder.build(); }
TaskConfig { public HostConfig hostConfig(final Optional<String> dockerVersion) { final List<String> securityOpt = job.getSecurityOpt(); final HostConfig.Builder builder = HostConfig.builder() .binds(binds()) .portBindings(portBindings()) .dns(dns) .securityOpt(securityOpt.toArray(new String[securityOpt.size()])) .runtime(job.getRuntime()) .networkMode(job.getNetworkMode()); if (!job.getRamdisks().isEmpty()) { builder.tmpfs(job.getRamdisks()); } final Resources resources = job.getResources(); if (resources != null) { builder.memory(resources.getMemory()); builder.memorySwap(resources.getMemorySwap()); builder.cpusetCpus(resources.getCpuset()); builder.cpuShares(resources.getCpuShares()); } builder.capAdd(ImmutableList.copyOf(job.getAddCapabilities())); builder.capDrop(ImmutableList.copyOf(job.getDropCapabilities())); for (final ContainerDecorator decorator : containerDecorators) { decorator.decorateHostConfig(job, dockerVersion, builder); } return builder.build(); } }
TaskConfig { public HostConfig hostConfig(final Optional<String> dockerVersion) { final List<String> securityOpt = job.getSecurityOpt(); final HostConfig.Builder builder = HostConfig.builder() .binds(binds()) .portBindings(portBindings()) .dns(dns) .securityOpt(securityOpt.toArray(new String[securityOpt.size()])) .runtime(job.getRuntime()) .networkMode(job.getNetworkMode()); if (!job.getRamdisks().isEmpty()) { builder.tmpfs(job.getRamdisks()); } final Resources resources = job.getResources(); if (resources != null) { builder.memory(resources.getMemory()); builder.memorySwap(resources.getMemorySwap()); builder.cpusetCpus(resources.getCpuset()); builder.cpuShares(resources.getCpuShares()); } builder.capAdd(ImmutableList.copyOf(job.getAddCapabilities())); builder.capDrop(ImmutableList.copyOf(job.getDropCapabilities())); for (final ContainerDecorator decorator : containerDecorators) { decorator.decorateHostConfig(job, dockerVersion, builder); } return builder.build(); } private  TaskConfig(final Builder builder); }
TaskConfig { public HostConfig hostConfig(final Optional<String> dockerVersion) { final List<String> securityOpt = job.getSecurityOpt(); final HostConfig.Builder builder = HostConfig.builder() .binds(binds()) .portBindings(portBindings()) .dns(dns) .securityOpt(securityOpt.toArray(new String[securityOpt.size()])) .runtime(job.getRuntime()) .networkMode(job.getNetworkMode()); if (!job.getRamdisks().isEmpty()) { builder.tmpfs(job.getRamdisks()); } final Resources resources = job.getResources(); if (resources != null) { builder.memory(resources.getMemory()); builder.memorySwap(resources.getMemorySwap()); builder.cpusetCpus(resources.getCpuset()); builder.cpuShares(resources.getCpuShares()); } builder.capAdd(ImmutableList.copyOf(job.getAddCapabilities())); builder.capDrop(ImmutableList.copyOf(job.getDropCapabilities())); for (final ContainerDecorator decorator : containerDecorators) { decorator.decorateHostConfig(job, dockerVersion, builder); } return builder.build(); } private  TaskConfig(final Builder builder); String containerName(); ContainerConfig containerConfig(final ImageInfo imageInfo,
                                         final Optional<String> dockerVersion); Map<String, PortMapping> ports(); Map<String, String> containerEnv(); ServiceRegistration registration(); HealthCheck healthCheck(); HostConfig hostConfig(final Optional<String> dockerVersion); static Builder builder(); String containerImage(); String name(); @Override String toString(); }
TaskConfig { public HostConfig hostConfig(final Optional<String> dockerVersion) { final List<String> securityOpt = job.getSecurityOpt(); final HostConfig.Builder builder = HostConfig.builder() .binds(binds()) .portBindings(portBindings()) .dns(dns) .securityOpt(securityOpt.toArray(new String[securityOpt.size()])) .runtime(job.getRuntime()) .networkMode(job.getNetworkMode()); if (!job.getRamdisks().isEmpty()) { builder.tmpfs(job.getRamdisks()); } final Resources resources = job.getResources(); if (resources != null) { builder.memory(resources.getMemory()); builder.memorySwap(resources.getMemorySwap()); builder.cpusetCpus(resources.getCpuset()); builder.cpuShares(resources.getCpuShares()); } builder.capAdd(ImmutableList.copyOf(job.getAddCapabilities())); builder.capDrop(ImmutableList.copyOf(job.getDropCapabilities())); for (final ContainerDecorator decorator : containerDecorators) { decorator.decorateHostConfig(job, dockerVersion, builder); } return builder.build(); } private  TaskConfig(final Builder builder); String containerName(); ContainerConfig containerConfig(final ImageInfo imageInfo,
                                         final Optional<String> dockerVersion); Map<String, PortMapping> ports(); Map<String, String> containerEnv(); ServiceRegistration registration(); HealthCheck healthCheck(); HostConfig hostConfig(final Optional<String> dockerVersion); static Builder builder(); String containerImage(); String name(); @Override String toString();  }