Class DockerMachine
- java.lang.Object
-
- com.oracle.bedrock.runtime.docker.machine.DockerMachine
-
public class DockerMachine extends Object
An encapsulation of a Docker Machine environment.Copyright (c) 2016. All Rights Reserved. Oracle Corporation.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.- Author:
- Jonathan Knight
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DockerMachineat(com.oracle.bedrock.runtime.Platform platform)Create aDockerMachineusing the specifiedPlatformas the platform to execute Docker Machine commands.DockerMachinebugSnagToken(String token)Specify the BugSnag API token for crash reportingDockerMachinePlatformcreate(String machineName, com.oracle.bedrock.Option... options)Obtain aDockerMachinePlatformwrapping a new Docker Machine VM.DockerMachinedebug()Enable debug mode.List<com.oracle.bedrock.runtime.options.EnvironmentVariable>environmentFor(String machineName)Obtain theEnvironmentVariables that can be applied to a Docker command to make it execute against the specified Docker Machine.InetAddressgetAddress(String machineName)Obtain theInetAddressof the specified Docker Machine.com.oracle.bedrock.runtime.PlatformgetClientPlatform()Obtain the clientPlatformused to issue Docker Machine commands.DockerMachinegithubToken(String token)Specify the token to use for requests to the Github APIjavax.json.JsonObjectinspect(String machineName)Obtain the status of the specified Docker Machine.intkill(String... machineNames)Kill (abruptly force stop) the specified Docker Machine instances.com.oracle.bedrock.runtime.Applicationlaunch(String command, com.oracle.bedrock.Option... options)Execute the specified DockerMachine command.static DockerMachinelocal()Create aDockerMachineusing theLocalPlatformas the platform to execute Docker Machine commands.DockerMachinenativeSSH()Use the native (Go-based) SSH implementationintremove(boolean force, String... machineNames)Remove the specified Docker Machine instances.intrestart(String... machineNames)Restart the specified Docker Machine instances.Stringstatus(String machineName)Obtain the status of the specified Docker Machine.intstop(String... machineNames)Stop the specified Docker Machine instances.DockerMachinestoragePath(File path)Specify the storage path.DockerMachinetlsCACert(Object cert)Specify the CA to verify remotes against.DockerMachinetlsCAKey(Object key)Specify the private key to generate certificates.DockerMachinetlsClientCert(Object cert)Specify the client cert to use for TLSDockerMachinetlsPrivateKey(Object key)Specify the private key used in client TLS authDockerMachinewithCommandOptions(com.oracle.bedrock.runtime.options.Argument... args)Add the specified Docker Machine command option.
-
-
-
Method Detail
-
getClientPlatform
public com.oracle.bedrock.runtime.Platform getClientPlatform()
Obtain the clientPlatformused to issue Docker Machine commands.- Returns:
- Obtain the client
Platformused to issue Docker Machine commands
-
withCommandOptions
public DockerMachine withCommandOptions(com.oracle.bedrock.runtime.options.Argument... args)
Add the specified Docker Machine command option.- Parameters:
args- the command line option to add- Returns:
- a new
DockerMachineinstance that is a copy of thisDockerMachinewith the specified command line option added
-
debug
public DockerMachine debug()
Enable debug mode.Equates to the
--debugcommand option.- Returns:
- a
DockerMachinethat is a copy of this instance with the--debugoption applied
-
storagePath
public DockerMachine storagePath(File path)
Specify the storage path.Equates to the
--storage-pathcommand option.- Parameters:
path- the storage path- Returns:
- a
DockerMachinethat is a copy of this instance with the--storage-pathoption applied
-
tlsCACert
public DockerMachine tlsCACert(Object cert)
Specify the CA to verify remotes against.Equates to the
--tls-ca-certcommand option.- Parameters:
cert- the cert- Returns:
- a
DockerMachinethat is a copy of this instance with the--tls-ca-certoption applied
-
tlsCAKey
public DockerMachine tlsCAKey(Object key)
Specify the private key to generate certificates.Equates to the
--tls-ca-keycommand option.- Parameters:
key- the key- Returns:
- a
DockerMachinethat is a copy of this instance with the--tls-ca-keyoption applied
-
tlsClientCert
public DockerMachine tlsClientCert(Object cert)
Specify the client cert to use for TLSEquates to the
--tls-client-certcommand option.- Parameters:
cert- the cert- Returns:
- a
DockerMachinethat is a copy of this instance with the--tls-client-certoption applied
-
tlsPrivateKey
public DockerMachine tlsPrivateKey(Object key)
Specify the private key used in client TLS authEquates to the
--tls-client-keycommand option.- Parameters:
key- the key- Returns:
- a
DockerMachinethat is a copy of this instance with the--tls-client-keyoption applied
-
githubToken
public DockerMachine githubToken(String token)
Specify the token to use for requests to the Github APIEquates to the
--github-api-tokencommand option.- Parameters:
token- the token- Returns:
- a
DockerMachinethat is a copy of this instance with the--github-api-tokenoption applied
-
nativeSSH
public DockerMachine nativeSSH()
Use the native (Go-based) SSH implementationEquates to the
--native-sshcommand option.- Returns:
- a
DockerMachinethat is a copy of this instance with the--native-sshoption applied
-
bugSnagToken
public DockerMachine bugSnagToken(String token)
Specify the BugSnag API token for crash reportingEquates to the
--bugsnag-api-tokencommand option.- Parameters:
token- the token- Returns:
- a
DockerMachinethat is a copy of this instance with the--bugsnag-api-tokenoption applied
-
getAddress
public InetAddress getAddress(String machineName)
Obtain theInetAddressof the specified Docker Machine.The equivalent of running the Docker Machine
ipcommand and turning the resulting address into anInetAddress.- Parameters:
machineName- the name of the Docker Machine to obtain the status for- Returns:
- the status of the specified Docker Machine
-
create
public DockerMachinePlatform create(String machineName, com.oracle.bedrock.Option... options)
Obtain aDockerMachinePlatformwrapping a new Docker Machine VM.- Parameters:
machineName- the name of the Docker Machine instance to createoptions- theOptions andArguments to pass to the create command- Returns:
- a
DockerMachinePlatformwrapping a new Docker Machine VM
-
launch
public com.oracle.bedrock.runtime.Application launch(String command, com.oracle.bedrock.Option... options)
Execute the specified DockerMachine command.- Parameters:
command- the command to executeoptions- theOptions to use- Returns:
- the
Applicationexecuting the command
-
status
public String status(String machineName)
Obtain the status of the specified Docker Machine.- Parameters:
machineName- the name of the Docker Machine to obtain the status for- Returns:
- the status of the specified Docker Machine
-
inspect
public javax.json.JsonObject inspect(String machineName)
Obtain the status of the specified Docker Machine.- Parameters:
machineName- the name of the Docker Machine to obtain the status for- Returns:
- a
JsonObjectwith the Docker Machine information
-
restart
public int restart(String... machineNames)
Restart the specified Docker Machine instances.- Parameters:
machineNames- the name of the Docker Machine instance to restart- Returns:
- the exit code from the restart command
-
remove
public int remove(boolean force, String... machineNames)Remove the specified Docker Machine instances.- Parameters:
force- force removal or notmachineNames- the name of the Docker Machine instance to remove- Returns:
- the exit code from the remove command
-
stop
public int stop(String... machineNames)
Stop the specified Docker Machine instances.- Parameters:
machineNames- the name of the Docker Machine instance to stop- Returns:
- the exit code from the stop command
-
kill
public int kill(String... machineNames)
Kill (abruptly force stop) the specified Docker Machine instances.- Parameters:
machineNames- the name of the Docker Machine instance to kill- Returns:
- the exit code from the kill command
-
environmentFor
public List<com.oracle.bedrock.runtime.options.EnvironmentVariable> environmentFor(String machineName)
Obtain theEnvironmentVariables that can be applied to a Docker command to make it execute against the specified Docker Machine.- Parameters:
machineName- the name of the Docker Machine- Returns:
- the
EnvironmentVariables required to use the Docker Machine
-
local
public static DockerMachine local()
Create aDockerMachineusing theLocalPlatformas the platform to execute Docker Machine commands.- Returns:
- a
DockerMachineusing theLocalPlatform
-
at
public static DockerMachine at(com.oracle.bedrock.runtime.Platform platform)
Create aDockerMachineusing the specifiedPlatformas the platform to execute Docker Machine commands.- Parameters:
platform- thePlatform- Returns:
- a
DockerMachineusing the specified clientPlatform
-
-