Class DockerTemplateOptions
- java.lang.Object
- 
- org.jclouds.compute.options.RunScriptOptions
- 
- org.jclouds.compute.options.TemplateOptions
- 
- org.jclouds.docker.compute.options.DockerTemplateOptions
 
 
 
- 
- All Implemented Interfaces:
- Cloneable
 
 public class DockerTemplateOptions extends TemplateOptions implements Cloneable Contains options supported by thecreateNodesoperation on the docker provider.UsageThe recommended way to instantiate a DockerTemplateOptions object is to statically importDockerTemplateOptions.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 UsageIn addition to basic configuration through its methods, this class also provides possibility to work directly with Docker API configuration object ( Config.Builder). When theconfigBuilder(org.jclouds.docker.domain.Config.Builder)is used to configure not-nullconfigBuilder, then this configuration object takes precedence over the other configuration in this class (i.e. the other config entries are not used)Note: The imageproperty in the providedConfig.Builderis 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());
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classDockerTemplateOptions.Builder- 
Nested classes/interfaces inherited from class org.jclouds.compute.options.TemplateOptionsTemplateOptions.ImmutableTemplateOptions
 - 
Nested classes/interfaces inherited from class org.jclouds.compute.options.RunScriptOptionsRunScriptOptions.ImmutableRunScriptOptions
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected Config.BuilderconfigBuilderprotected IntegercpuSharesprotected List<String>dnsprotected List<String>envprotected Map<String,String>extraHostsprotected Stringhostnameprotected Integermemoryprotected StringnetworkModeprotected booleanopenStdinprotected Map<Integer,Integer>portBindingsprotected booleanprivilegedprotected Map<String,String>volumesprotected List<String>volumesFrom- 
Fields inherited from class org.jclouds.compute.options.TemplateOptionsblockUntilRunning, inboundPorts, networks, nodeNames, NONE, privateKey, publicKey, script, securityGroups, tags, userMetadata
 - 
Fields inherited from class org.jclouds.compute.options.RunScriptOptionsauthenticateSudo, blockOnComplete, loginPassword, loginPrivateKey, loginUser, port, runAsRoot, seconds, taskName, wrapInInitScript
 
- 
 - 
Constructor SummaryConstructors Constructor Description DockerTemplateOptions()
 - 
Method Summary- 
Methods inherited from class org.jclouds.compute.options.TemplateOptionsas, blockOnComplete, getGroups, getInboundPorts, getNetworks, getNodeNames, getPrivateKey, getPublicKey, getRunScript, getTags, getUserMetadata, networks, runScript, securityGroups, securityGroups, shouldBlockUntilRunning, string, tags, wrapInInitScript
 - 
Methods inherited from class org.jclouds.compute.options.RunScriptOptionscopyTo, getLoginPassword, getLoginPrivateKey, getLoginUser, getPort, getSeconds, getTaskName, hasLoginPassword, hasLoginPasswordOption, hasLoginPrivateKey, hasLoginPrivateKeyOption, overrideLoginPassword, overrideLoginPrivateKey, shouldAuthenticateSudo, shouldBlockOnComplete, shouldRunAsRoot, shouldWrapInInitScript
 
- 
 
- 
- 
- 
Field Detail- 
privilegedprotected boolean privileged 
 - 
openStdinprotected boolean openStdin 
 - 
configBuilderprotected Config.Builder configBuilder 
 
- 
 - 
Method Detail- 
clonepublic DockerTemplateOptions clone() - Overrides:
- clonein class- TemplateOptions
 
 - 
copyTopublic void copyTo(TemplateOptions to) - Overrides:
- copyToin class- TemplateOptions
 
 - 
equalspublic boolean equals(Object o) - Overrides:
- equalsin class- TemplateOptions
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- TemplateOptions
 
 - 
toStringpublic String toString() - Overrides:
- toStringin class- RunScriptOptions
 
 - 
volumespublic DockerTemplateOptions volumes(Map<String,String> volumes) 
 - 
dnspublic DockerTemplateOptions dns(Iterable<String> dns) 
 - 
dnspublic DockerTemplateOptions dns(String... dns) 
 - 
hostnamepublic DockerTemplateOptions hostname(@Nullable String hostname) 
 - 
memorypublic DockerTemplateOptions memory(@Nullable Integer memory) 
 - 
entrypointpublic DockerTemplateOptions entrypoint(Iterable<String> entrypoint) 
 - 
entrypointpublic DockerTemplateOptions entrypoint(String... entrypoint) 
 - 
commandspublic DockerTemplateOptions commands(Iterable<String> commands) 
 - 
commandspublic DockerTemplateOptions commands(String... commands) 
 - 
cpuSharespublic DockerTemplateOptions cpuShares(@Nullable Integer cpuShares) 
 - 
envpublic DockerTemplateOptions env(Iterable<String> env) 
 - 
envpublic DockerTemplateOptions env(String... env) 
 - 
portBindingspublic DockerTemplateOptions portBindings(Map<Integer,Integer> portBindings) Set port bindings between the Docker host and a container.The Mapkeys are host ports number, and the value for an entry is the container port number. This is the same order as the arguments for the--publishcommand-line option todocker runwhich ishostPort:containerPort.- Parameters:
- portBindings- the map of host to container port bindings
 
 - 
networkModepublic DockerTemplateOptions networkMode(@Nullable String networkMode) Sets the networking mode for the container.Supported values are: bridge,none,host,networkname,networkidorcontainer:[name|id]- Parameters:
- networkMode-
- Returns:
- this instance
 
 - 
extraHostspublic DockerTemplateOptions extraHosts(Map<String,String> extraHosts) Set extra hosts file entries for a container.The Mapkeys are host names, and the value is an IP address that can be accessed by the container. This is the same order as the arguments for the--add-hostcommand-line option todocker run.- Parameters:
- extraHosts- the map of host names to IP addresses
 
 - 
volumesFrompublic DockerTemplateOptions volumesFrom(Iterable<String> volumesFrom) Set list of containers to mount volumes from onto this container.- Parameters:
- volumesFrom- the list of container names
 
 - 
privilegedpublic DockerTemplateOptions privileged(boolean privileged) By default, Docker containers are unprivileged and cannot execute privileged operations or access certain host devices.- Parameters:
- privileged- Whether the container should run in privileged mode or not
- Returns:
- this instance
 
 - 
openStdinpublic DockerTemplateOptions openStdin(boolean openStdin) KeepSTDINopen when running interactive workloads in the container.- Parameters:
- openStdin- Whether the container should keep STDIN open
- Returns:
- this instance
 
 - 
configBuilderpublic DockerTemplateOptions configBuilder(Config.Builder configBuilder) This method sets Config.Builder configuration object, which can be used as a replacement for all the other settings from this class. Some values in the provided Config.Builder instance (the image name for instance) can be ignored or their value can be changed.- Parameters:
- configBuilder- Config.Builder instance. This instance can be changed in this method!
 
 - 
getHostnamepublic String getHostname() 
 - 
getMemorypublic Integer getMemory() 
 - 
getCpuSharespublic Integer getCpuShares() 
 - 
getNetworkModepublic String getNetworkMode() 
 - 
getPrivilegedpublic boolean getPrivileged() 
 - 
getOpenStdinpublic boolean getOpenStdin() 
 - 
getConfigBuilderpublic Config.Builder getConfigBuilder() 
 - 
blockOnPortpublic DockerTemplateOptions blockOnPort(int port, int seconds) When the node is started, wait until the following port is active- Overrides:
- blockOnPortin class- TemplateOptions
 
 - 
inboundPortspublic DockerTemplateOptions inboundPorts(int... ports) Opens the set of ports to public access.- Overrides:
- inboundPortsin class- TemplateOptions
 
 - 
authorizePublicKeypublic DockerTemplateOptions authorizePublicKey(String publicKey) authorize an rsa ssh key.- Overrides:
- authorizePublicKeyin class- TemplateOptions
 
 - 
installPrivateKeypublic DockerTemplateOptions installPrivateKey(String privateKey) replaces the rsa ssh key used at login.- Overrides:
- installPrivateKeyin class- TemplateOptions
 
 - 
blockUntilRunningpublic DockerTemplateOptions blockUntilRunning(boolean blockUntilRunning) NoteAs of version 1.1.0, this option is incompatible withTemplateOptions.runScript(Statement)andRunScriptOptions.blockOnComplete(boolean), as all current implementations utilize ssh in order to execute scripts.- Overrides:
- blockUntilRunningin class- TemplateOptions
- Parameters:
- blockUntilRunning- (default true) whether to block until the nodes in this template are in- Status#RUNNINGstate
 
 - 
dontAuthorizePublicKeypublic DockerTemplateOptions dontAuthorizePublicKey() - Overrides:
- dontAuthorizePublicKeyin class- TemplateOptions
 
 - 
nameTaskpublic DockerTemplateOptions nameTask(String name) - Overrides:
- nameTaskin class- TemplateOptions
- Returns:
- What to call the task relating to this script; default
         jclouds-script-timestampwhere timestamp is millis since epoch
 
 - 
runAsRootpublic DockerTemplateOptions runAsRoot(boolean runAsRoot) - Overrides:
- runAsRootin class- TemplateOptions
 
 - 
runScriptpublic DockerTemplateOptions runScript(Statement script) This script will be executed as the root user upon system startup. This script gets a prologue, so no #!/bin/bash required, path set up, etc- Overrides:
- runScriptin class- TemplateOptions
 
 - 
overrideLoginCredentialspublic DockerTemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials) - Overrides:
- overrideLoginCredentialsin class- TemplateOptions
 
 - 
overrideLoginPasswordpublic DockerTemplateOptions overrideLoginPassword(String password) - Overrides:
- overrideLoginPasswordin class- TemplateOptions
 
 - 
overrideLoginPrivateKeypublic DockerTemplateOptions overrideLoginPrivateKey(String privateKey) - Overrides:
- overrideLoginPrivateKeyin class- TemplateOptions
 
 - 
overrideLoginUserpublic DockerTemplateOptions overrideLoginUser(String loginUser) - Overrides:
- overrideLoginUserin class- TemplateOptions
 
 - 
overrideAuthenticateSudopublic DockerTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) - Overrides:
- overrideAuthenticateSudoin class- TemplateOptions
 
 - 
userMetadatapublic DockerTemplateOptions userMetadata(Map<String,String> userMetadata) - Overrides:
- userMetadatain class- TemplateOptions
- Parameters:
- userMetadata- user-defined metadata to assign to this server
 
 - 
userMetadatapublic DockerTemplateOptions userMetadata(String key, String value) - Overrides:
- userMetadatain class- TemplateOptions
- Parameters:
- key- key to place into the metadata map
- value- value to associate with that key
 
 - 
nodeNamespublic DockerTemplateOptions nodeNames(Iterable<String> nodeNames) specifies names to be used for the created nodes. Note that this does not guarantee uniqueness - if there are already existing nodes with a name specified here, there will still be a new node created with the same name. Also, if more nodes are to be created than there are names, subsequent names will use the default naming strategy for that cloud.- Overrides:
- nodeNamesin class- TemplateOptions
 
 - 
networkspublic DockerTemplateOptions networks(Iterable<String> networks) Assigns the created nodes to these networks- Overrides:
- networksin class- TemplateOptions
 
 
- 
 
-