public class DockerTemplateOptions extends TemplateOptions implements Cloneable
createNodes operation on the docker provider.
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());
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());
| Modifier and Type | Class and Description |
|---|---|
static class |
DockerTemplateOptions.Builder |
TemplateOptions.ImmutableTemplateOptionsRunScriptOptions.ImmutableRunScriptOptions| Modifier and Type | Field and Description |
|---|---|
protected Config.Builder |
configBuilder |
protected Integer |
cpuShares |
protected List<String> |
dns |
protected List<String> |
env |
protected Map<String,String> |
extraHosts |
protected String |
hostname |
protected Integer |
memory |
protected String |
networkMode |
protected boolean |
openStdin |
protected Map<Integer,Integer> |
portBindings |
protected boolean |
privileged |
protected Map<String,String> |
volumes |
protected List<String> |
volumesFrom |
blockUntilRunning, inboundPorts, networks, nodeNames, NONE, privateKey, publicKey, script, securityGroups, tags, userMetadataauthenticateSudo, blockOnComplete, loginPassword, loginPrivateKey, loginUser, port, runAsRoot, seconds, taskName, wrapInInitScript| Constructor and Description |
|---|
DockerTemplateOptions() |
as, blockOnComplete, getGroups, getInboundPorts, getNetworks, getNodeNames, getPrivateKey, getPublicKey, getRunScript, getTags, getUserMetadata, networks, runScript, securityGroups, securityGroups, shouldBlockUntilRunning, string, tags, wrapInInitScriptcopyTo, getLoginPassword, getLoginPrivateKey, getLoginUser, getPort, getSeconds, getTaskName, hasLoginPassword, hasLoginPasswordOption, hasLoginPrivateKey, hasLoginPrivateKeyOption, overrideLoginPassword, overrideLoginPrivateKey, shouldAuthenticateSudo, shouldBlockOnComplete, shouldRunAsRoot, shouldWrapInInitScriptprotected boolean privileged
protected boolean openStdin
protected Config.Builder configBuilder
public DockerTemplateOptions clone()
clone in class TemplateOptionspublic void copyTo(TemplateOptions to)
copyTo in class TemplateOptionspublic boolean equals(Object o)
equals in class TemplateOptionspublic int hashCode()
hashCode in class TemplateOptionspublic String toString()
toString in class RunScriptOptionspublic DockerTemplateOptions volumes(Map<String,String> volumes)
public DockerTemplateOptions dns(Iterable<String> dns)
public DockerTemplateOptions dns(String... dns)
public DockerTemplateOptions hostname(@Nullable String hostname)
public DockerTemplateOptions memory(@Nullable Integer memory)
public DockerTemplateOptions entrypoint(Iterable<String> entrypoint)
public DockerTemplateOptions entrypoint(String... entrypoint)
public DockerTemplateOptions commands(Iterable<String> commands)
public DockerTemplateOptions commands(String... commands)
public DockerTemplateOptions cpuShares(@Nullable Integer cpuShares)
public DockerTemplateOptions env(Iterable<String> env)
public DockerTemplateOptions env(String... env)
public DockerTemplateOptions portBindings(Map<Integer,Integer> portBindings)
The Map keys 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
--publish command-line option to docker run which is
hostPort:containerPort.
portBindings - the map of host to container port bindingspublic DockerTemplateOptions networkMode(@Nullable String networkMode)
Supported values are: bridge, none, host,
networkname, networkid or container:[name|id]
networkMode - public DockerTemplateOptions extraHosts(Map<String,String> extraHosts)
The Map keys 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-host command-line option to docker run.
extraHosts - the map of host names to IP addressespublic DockerTemplateOptions volumesFrom(Iterable<String> volumesFrom)
volumesFrom - the list of container namespublic DockerTemplateOptions privileged(boolean privileged)
privileged - Whether the container should run in privileged mode or notpublic DockerTemplateOptions openStdin(boolean openStdin)
STDIN open when running interactive workloads in the container.openStdin - Whether the container should keep STDIN openpublic DockerTemplateOptions configBuilder(Config.Builder configBuilder)
configBuilder - Config.Builder instance. This instance can be changed in this
method!public String getHostname()
public Integer getMemory()
public Integer getCpuShares()
public String getNetworkMode()
public boolean getPrivileged()
public boolean getOpenStdin()
public Config.Builder getConfigBuilder()
public DockerTemplateOptions blockOnPort(int port, int seconds)
blockOnPort in class TemplateOptionspublic DockerTemplateOptions inboundPorts(int... ports)
inboundPorts in class TemplateOptionspublic DockerTemplateOptions authorizePublicKey(String publicKey)
authorizePublicKey in class TemplateOptionspublic DockerTemplateOptions installPrivateKey(String privateKey)
installPrivateKey in class TemplateOptionspublic DockerTemplateOptions blockUntilRunning(boolean blockUntilRunning)
TemplateOptions.runScript(Statement) and
RunScriptOptions.blockOnComplete(boolean), as all current
implementations utilize ssh in order to execute scripts.blockUntilRunning in class TemplateOptionsblockUntilRunning - (default true) whether to block until the nodes in this template
are in Status#RUNNING statepublic DockerTemplateOptions dontAuthorizePublicKey()
dontAuthorizePublicKey in class TemplateOptionspublic DockerTemplateOptions nameTask(String name)
nameTask in class TemplateOptionsjclouds-script-timestamp where timestamp is millis since
epochpublic DockerTemplateOptions runAsRoot(boolean runAsRoot)
runAsRoot in class TemplateOptionspublic DockerTemplateOptions runScript(Statement script)
runScript in class TemplateOptionspublic DockerTemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials)
overrideLoginCredentials in class TemplateOptionspublic DockerTemplateOptions overrideLoginPassword(String password)
overrideLoginPassword in class TemplateOptionspublic DockerTemplateOptions overrideLoginPrivateKey(String privateKey)
overrideLoginPrivateKey in class TemplateOptionspublic DockerTemplateOptions overrideLoginUser(String loginUser)
overrideLoginUser in class TemplateOptionspublic DockerTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo)
overrideAuthenticateSudo in class TemplateOptionspublic DockerTemplateOptions userMetadata(Map<String,String> userMetadata)
userMetadata in class TemplateOptionsuserMetadata - user-defined metadata to assign to this serverpublic DockerTemplateOptions userMetadata(String key, String value)
userMetadata in class TemplateOptionskey - key to place into the metadata mapvalue - value to associate with that keypublic DockerTemplateOptions nodeNames(Iterable<String> nodeNames)
nodeNames in class TemplateOptionspublic DockerTemplateOptions networks(Iterable<String> networks)
networks in class TemplateOptionsCopyright © 2009-2016 The Apache Software Foundation. All Rights Reserved.