Class DockerTemplateOptions

  • All Implemented Interfaces:
    Cloneable

    public class DockerTemplateOptions
    extends TemplateOptions
    implements Cloneable
    Contains options supported by the createNodes operation on the docker provider.

    Usage

    The recommended way to instantiate a DockerTemplateOptions object is to statically import DockerTemplateOptions.Builder.* and invoke one of the static creation methods, followed by an instance mutator if needed.
     import static org.jclouds.docker.compute.options.DockerTemplateOptions.Builder.*;
    
     ComputeService api = // get connection
     templateBuilder.options(inboundPorts(22, 80, 8080, 443));
     Set<? extends NodeMetadata> set = api.createNodesInGroup(tag, 2, templateBuilder.build());
     

    Advanced Usage

    In addition to basic configuration through its methods, this class also provides possibility to work directly with Docker API configuration object ( Config.Builder). When the configBuilder(org.jclouds.docker.domain.Config.Builder) is used to configure not-null configBuilder, then this configuration object takes precedence over the other configuration in this class (i.e. the other config entries are not used)

    Note: The image property in the provided Config.Builder is rewritten by a placeholder value. The real value is configured by ComputeServiceAdapter.

     import static org.jclouds.docker.compute.options.DockerTemplateOptions.Builder.*;
    
     ComputeService api = // get connection
     DockerTemplateOptions options = DockerTemplateOptions.Builder
           .configBuilder(
                    Config.builder().env(ImmutableList.<String> of("SSH_PORT=8822"))
                          .hostConfig(HostConfig.builder().networkMode("host").build()));
     templateBuilder.options(options);
     Set<? extends NodeMetadata> set = api.createNodesInGroup("sample-group", 1, templateBuilder.build());