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();
  }
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 ( ) ; }
Create a container host configuration for the job.

@return The host configuration.