DockerCommander class
The Docker manager.
Constructors
- DockerCommander(DockerHost dockerHost)
Properties
- defaultOutputTime → Duration
-
The default timeout to wait data in STDOUT/STDERR outputs.
no setterinherited
- dockerHost → DockerHost
-
Docker machine host.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isInitialized → bool
-
Returns
true
if is initialized, even if is initialized with errors.no setter - isSuccessfullyInitialized → bool
-
Returns
true
if is successfully initialized.no setter - lastDaemonCheck → DateTime?
-
Returns the last DateTime that Docker daemon was checked.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- session → int
-
Returns
dockerHost.session
no setter
Methods
-
checkDaemon(
) → Future< void> - Checks if Docker daemon is accessible.
-
close(
) → Future< void> - Closes this instances, and internal dockerHost.
-
command(
String command, List< String> args, {bool outputAsLines = true, int? outputLimit, OutputReadyFunction? stdoutReadyFunction, OutputReadyFunction? stderrReadyFunction, OutputReadyType? outputReadyType}) → Future<DockerProcess?> -
Executes a Docker command with
args
-
createContainer(
String containerName, String imageName, {String? version, List< String> ? ports, String? network, String? hostname, Map<String, String> ? environment, Map<String, String> ? volumes, bool cleanContainer = false, String? healthCmd, Duration? healthInterval, int? healthRetries, Duration? healthStartPeriod, Duration? healthTimeout, String? restart}) → Future<ContainerInfos?> -
Creates a Docker container with
containerName
,image
and optionalversion
. -
createNetwork(
[String? networkName]) → Future< String?> -
Creates a Docker network with
networkName
. -
createService(
String serviceName, String imageName, {String? version, int? replicas, List< String> ? ports, String? network, String? hostname, Map<String, String> ? environment, Map<String, String> ? volumes, String? healthCmd, Duration? healthInterval, int? healthRetries, Duration? healthStartPeriod, Duration? healthTimeout}) → Future<Service?> -
Creates a Docker service with
serviceName
,image
and optionalversion
. Note that the Docker Daemon should be in Swarm mode. -
createTempFile(
String content) → Future< String?> - Creates a temporary file.
-
deleteTempFile(
String filePath) → Future< bool> -
Deletes a temporary
filePath
. -
ensureInitialized(
) → Future< bool> - Ensures that this instance is initialized.
-
exec(
String containerName, String? command, List< String> args, {bool outputAsLines = true, int? outputLimit, OutputReadyFunction? stdoutReadyFunction, OutputReadyFunction? stderrReadyFunction, OutputReadyType? outputReadyType}) → Future<DockerProcess?> -
Executes a
command
inside this container withargs
Only executes if isContainerRunnerRunningcontainerName
returns true. -
execAnConfirmExit(
String containerName, String command, List< String> args, int desiredExitCode) → Future<bool> -
Calls exec than
waitExit
.inherited -
execAndWaitExit(
String containerName, String command, List< String> args, {int? desiredExitCode}) → Future<int?> -
Calls exec than
waitExit
.inherited -
execAndWaitStderr(
String containerName, String command, List< String> args, {int? desiredExitCode}) → Future<Output?> -
Calls exec than
waitStderr
.inherited -
execAndWaitStderrAsString(
String containerName, String command, List< String> args, {bool trim = false, int? desiredExitCode, Pattern? dataMatcher}) → Future<String?> -
Calls execAndWaitStderrAsString and returns Output.asString.
inherited
-
execAndWaitStdout(
String containerName, String command, List< String> args, {int? desiredExitCode}) → Future<Output?> -
Calls exec than
waitStdout
.inherited -
execAndWaitStdoutAsString(
String containerName, String command, List< String> args, {bool trim = false, int? desiredExitCode, Pattern? dataMatcher}) → Future<String?> -
Calls execAndWaitStdoutAsString and returns Output.asString.
inherited
-
execWhich(
String containerName, String commandName, {bool ignoreCache = false, String? def}) → Future< String?> -
Call POSIX
which
command. Calls exec with commandwhich
and argscommandName
. Caches response than returns the executable path forcommandName
.inherited -
formulaExec(
String formulaName, String functionName, [List? arguments, Map< String, dynamic> ? fields]) → Future - Executes a formula function.
-
getContainerIP(
String name) → Future< String?> -
Returns the container IP by
name
. -
getFormulaClassName(
String formulaName) → Future< String?> - Returns the class name of a formula.
-
getFormulaFields(
String formulaName) → Future< Map< String, Object> > - Returns the formula fields/properties.
-
getSwarmInfos(
) → Future< SwarmInfos?> -
Returns a
SwarmInfos
. Only if in Swarm mode. -
initialize(
) → Future< bool> - Initializes instance.
-
isContainerARunner(
String containerName) → bool -
Returns
true
containerName
has a DockerRunner. -
isContainerRunnerRunning(
String containerName) → bool -
Returns
true
if DockerRunner ofcontainerName
is running. -
isContainerRunning(
String containerName) → Future< bool> -
Returns if
containerName
is running (checks at Docker Daemon).inherited -
isDaemonRunning(
) → Future< bool> -
Returns
true
if Docker daemon is accessible. -
isInSwarmMode(
) → Future< bool> - Returns true if this Docker Daemon is in Swarm mode.
-
listFormulasFunctions(
String formulaName) → Future< List< String> > - List the functions of a formula.
-
listFormulasNames(
) → Future< List< String> > - List the current available formulas names.
-
listServicesNames(
) → Future< List< String> ?> - Returns a list of services names.
-
listServiceTasks(
String serviceName) → Future< List< ServiceTaskInfos> ?> -
Returns a list of ServiceTaskInfos of a service by
serviceName
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
openContainerLogs(
String containerNameOrID) → Future< DockerProcess?> -
Opens a Container logs, by
containerNameOrID
. -
openServiceLogs(
String serviceNameOrTask) → Future< DockerProcess?> -
Opens a Service logs, by
serviceNameOrTask
. -
psContainerNames(
{bool all = true}) → Future< List< String> ?> -
Executes Docker command
docker ps --format "{{.Names}}"
-
removeContainer(
String containerNameOrID, {bool force = false}) → Future< bool> -
Removes a container by
containerNameOrID
. -
removeNetwork(
String? networkName) → Future< bool> -
Removes a Docker network with
networkName
. -
run(
String image, {String? version, List< String> ? imageArgs, String? containerName, List<String> ? ports, String? network, String? hostname, Map<String, String> ? environment, Map<String, String> ? volumes, bool cleanContainer = true, String? healthCmd, Duration? healthInterval, int? healthRetries, Duration? healthStartPeriod, Duration? healthTimeout, bool outputAsLines = true, int? outputLimit, OutputReadyFunction? stdoutReadyFunction, OutputReadyFunction? stderrReadyFunction, DockerContainerInstantiator? dockerContainerInstantiator}) → Future<DockerContainer?> -
Runs a Docker container, using
image
and optionalversion
. -
startContainer(
String containerNameOrID) → Future< bool> -
Starts a container by
containerNameOrID
. -
stopContainer(
String containerNameOrID, {Duration? timeout}) → Future< bool> -
Stops a container by
containerNameOrID
with an optionaltimeout
. -
swarmInit(
{String? advertiseAddress, String? listenAddress}) → Future< SwarmInfos?> - Initialize swarm mode. Returns the secret key to join the cluster.
-
swarmLeave(
{bool force = false}) → Future< bool> - Leaves a swarm cluster.
-
swarmSelfNodeID(
) → Future< String?> - Returns the node ID of the current Docker Daemon the swarm cluster.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited