docker_commander 3.1.0 copy "docker_commander: ^3.1.0" to clipboard
docker_commander: ^3.1.0 copied to clipboard

A Docker manager for local and remote host machines. Works with personalized containers and pre-configured popular containers, like PostgreSQL, Apache HTTPD and NGINX.

3.1.0 #

  • DockerRunOptions: every option of a docker run / docker create, in one class that builds the CLI arguments (toArgs) and the JSON sent to a remote host (toJson / fromJson). Local and remote hosts and the console all accept it. DockerCommander.run, DockerCommander.createContainer, DockerHost.run, DockerHost.createContainer and DockerContainerConfig take a new options parameter, merged over the existing named parameters, which keep working.

    • New options: tmpfs, shmSize, memory, cpus, ulimits, user, workdir, entrypoint, init, stopSignal, stopTimeout, platform, pull, labels, addHosts, and extraArgs for anything not modelled yet.
    • DockerHost.buildContainerArgsWithOptions builds the arguments; buildContainerArgs now delegates to it. DockerHostLocal.buildContainerArgs no longer takes addCIDFile (moved to buildContainerArgsWithOptions).
  • Host ports chosen by Docker: a host port of 0 (ports: ['0:5432'], or hostPort: 0 in the container configs) publishes on a free host port. The chosen port is resolved once the container is ready: DockerContainer.hostPortFor(5432), DockerContainer.ports and DockerCommander.getContainerPortMappings. No race between parallel runs picking the same port.

  • Labels and cleanup: every container run or created is labelled with its session (docker_commander.session).

    • DockerCommander.cleanupSession, removeContainersByLabel and listContainersByLabel.
  • Reuse: DockerRunOptions(reuse: true) attaches to a running container started with the same image and options (found by a config-hash label), following its logs, instead of starting a new one. DockerContainer.isReused. The hash leaves out the session label, so other sessions and remote clients find the same container. Only for run.

  • Health checks: DockerContainer.waitHealthy and healthStatus.

  • Images: DockerCommander.imageExists, pullImage and ensureImage.

  • PostgreSQLContainerConfig:

    • settings (each -c key=value), initdbArgs (POSTGRES_INITDB_ARGS), extraEnvironment and options.
    • ephemeral: a throwaway database for tests: fsync, synchronous_commit and full_page_writes off, initdb --no-sync, and the data directory on a tmpfs mount (through PGDATA, so it doesn't depend on the image's default data path).
    • PostgreSQLContainer.runSQLScript: runs a SQL script of any size, with line-breaks and quotes, through psql -v ON_ERROR_STOP=1 -f. The script is copied with docker cp, or, through a remote host (no temporary files), written in chunks that fit in a command-line argument.
    • Removed a leftover print from the ready check.
    • The empty-password error no longer prints the user name.
  • MySQLContainerConfig: settings (each --key=value), extraEnvironment, ephemeral (durability off, no binary log, data directory on tmpfs) and options.

  • Fixes:

    • The health options (healthCmd, healthInterval, healthRetries, healthStartPeriod, healthTimeout) were accepted but never passed to Docker. They are now.
    • DockerCommander.run dropped restart. It now passes it, and a restart policy other than no combined with cleanContainer (--rm, the default of run) throws an ArgumentError before contacting Docker (which would refuse it): pass cleanContainer: false. See DockerRunOptions.validate.
    • DockerHost.getContainerIDByName used docker ps -f name=..., which matches any name containing the given one (app-7 also matched app-70, returning both IDs), and returned a truncated 12-character ID while a container started by run has the full ID (from --cidfile). It now uses docker container inspect: an exact match, and the full ID.
    • docker_commander_server: a remote run with imageArgs failed casting the decoded JSON list to List<String>.
    • The server's create response now returns the normalized ports, network and hostname.
    • Output could be incomplete right after a process exited:
      • Remote: waitExit (and so waitStdout, runSQL, psqlCMD, execCat...) returned as soon as the server reported the exit, while the output was still being synced in the background. It now fetches the remaining output first. Output syncs run one at a time, so they can't add the same entries twice.
      • Local: the exit was recorded when Process.exitCode completed, which can be before STDOUT/STDERR are fully read. It now waits for them (up to 5s).
    • A volume with an empty container path no longer produces -v host:.
    • DockerRunOptions.normalizePorts keeps a port bound to an IP (127.0.0.1:80:80) as it is.
  • README: the PostgreSQL example used PostgreSQLContainer() instead of PostgreSQLContainerConfig().

3.0.1 #

  • DockerCommander.close: now awaits dockerHost.close() inside the try, so a failure while closing is actually caught by the surrounding catch instead of escaping as an unhandled asynchronous error.

  • Dependency updates:

    • swiss_knife: ^3.3.14
    • apollovm: ^2.31.0
    • test: ^1.32.0

3.0.0 #

  • apollovm: ^0.0.53 → ^2.0.0.

    • ApolloVM 2.0.0 no longer depends on wasm_run, which dragged an FFI/Rust toolchain and a long-abandoned flutter_rust_bridge 1.x into every consumer of docker_commander. That pinned shelf_web_socket ^1.0.2 / web_socket_channel ^2.2.0 transitively, locking dependents out of a modern shelf/WebSocket stack.
    • The formulas API is unchanged; this is a major release because DockerCommanderFormulaSource.getVM() exposes ApolloVM types in its public API.
    • Wasm execution is not used by the formulas engine, so apollovm_wasm is not needed here.
  • DockerCommanderFormula: a formula with no fields now runs its commands on a class instance, like any other formula.

    • ApolloVM builds a class instance only when it is given instance fields, and now rejects calling a non-static method without a this. Since formula commands are non-static methods, a field-less formula (GitLabFormula, ApacheFormula) failed with "Can't call non-static method 'X.getVersion' without a class instance". It previously ran against a missing this by accident.

2.1.8 #

  • DockerCMD:

    • copyFileToContainer and copyFileFromContainer: updated input validation to use block braces for clarity.
  • DockerCommanderConsole:

    • Removed default case returning false in command output handling switch.
  • ConsoleCMD:

    • Removed default case setting typeStr to null in return type string conversion.
  • Configuration:

    • Updated Dart SDK constraint to >=3.6.0 <4.0.0.
    • Dependency updates:
      • swiss_knife: ^3.3.5
      • mercury_client: ^2.3.0
      • collection: ^1.19.1
      • test: ^1.29.0

2.1.7 #

  • PostgreSQLContainerConfig:

    • postgresPort, maxConnections, logStatement.
  • MySQLContainerConfig:

    • _buildImageArgs: Ignore forceNativePasswordAuthentication for version 9+ (and latest).
  • swiss_knife: ^3.2.2

  • mercury_client: ^2.2.4

  • logging: ^1.3.0

  • test: ^1.25.8

  • path: ^1.9.1

2.1.6 #

  • PostgreSQLContainerConfig, MySQLContainerConfig, ApacheHttpdContainerConfig, NginxContainerConfig:

    • Constructor: expose version parameter.
  • MySQLContainerConfig:

    • Fix _buildImageArgs for version 8.4.0+.
  • swiss_knife: ^3.2.0

  • mercury_client: ^2.2.2

  • apollovm: ^0.0.53

  • version: ^3.0.2

  • test: ^1.25.5

  • path: ^1.9.0

2.1.5 #

  • apollovm: ^0.0.45

2.1.4 #

  • apollovm: ^0.0.43

2.1.3 #

  • apollovm: ^0.0.42

2.1.2 #

  • apollovm: ^0.0.41
  • dependency_validator: ^3.2.3

2.1.1 #

  • mercury_client: ^2.2.0
  • apollovm: ^0.0.32

2.1.0 #

  • sdk: '>=3.0.0 <4.0.0'

  • swiss_knife: ^3.1.5

  • mercury_client: ^2.1.8

  • logging: ^1.2.0

  • collection: ^1.18.0

  • apollovm: ^0.0.31

  • lints: ^2.1.1

  • test: ^1.24.6

  • dependency_validator: ^3.2.2

  • path: ^1.8.3

2.0.15 #

  • Fix DockerHost initialization concurrence issue.
  • DockerHost.
    • Added isDaemonRunning.

2.0.14 #

  • OutputStream:
    • Improve handling of multiple lines.
  • DockerContainerConfig:
    • Improved ready functions:
      • MySQLContainerConfig
      • PostgreSQLContainerConfig (updated)
      • ApacheHttpdContainerConfig
      • NginxContainerConfig
  • Organize imports.
  • Improve GitHub CI.
  • sdk: '>=2.15.0 <3.0.0'
  • swiss_knife: ^3.1.1
  • mercury_client: ^2.1.6
  • collection: ^1.16.0
  • lints: ^2.0.0
  • test: ^1.21.3
  • dependency_validator: ^3.2.0
  • pubspec: ^2.3.0
  • path: ^1.8.2

2.0.13 #

  • Added MySQLContainer.

2.0.12 #

  • DockerCMD.execShell: improved inline script normalization.
  • Added getFreeListenPort.
  • Classes that extends DockerContainerConfig now have a suffix config:
    • NginxContainerConfig, PostgreSQLContainerConfig, ApacheHttpdContainerConfig.
  • PostgreSQLContainer:
    • Added runSQL and psqlCMD.
  • Improved containers tests.
  • Added test tag no_docker, for tests that won't use the Docker Daemon.

2.0.11 #

  • apollovm compatibility.
  • Migrated from pedantic to lints.
  • Fixed issue with Formula and overwriteField.
  • Improved support for Docker on Windows.
  • Improved tests.
  • apollovm: ^0.0.30
  • swiss_knife: ^3.0.8
  • mercury_client: ^2.1.0
  • lints: ^1.0.1
  • dependency_validator: ^3.1.0

2.0.10 #

  • formulaExec: added fields option.
  • Improve gitlab formula.
  • docker_commander_console: added get-formulas-fields.
  • apollovm: ^0.0.22

2.0.9 #

  • Improved formulas test.
  • apollovm: ^0.0.21

2.0.8 #

  • Add to DockerCommander formula commands:
    • listFormulasNames
    • getFormulaClassName
    • listFormulasFunctions
    • formulaExec
  • docker_commander_console:
    • Added formulas commands.
  • Improve GitLab formula with class fields.
  • Fix server issue with invalid request.
  • apollovm: ^0.0.20

2.0.7 #

  • apollovm: ^0.0.19

2.0.6 #

  • Added GitLab Formula: GitLabFormulaSource
  • apollovm: ^0.0.16

2.0.5 #

  • Added restart to create/run container command.
  • Added command create-network to docker_commander_console.
  • Improve README.md Formulas section.

2.0.4 #

  • Formula repository (DockerCommanderFormulaRepository):
    • Standard implementation: DockerCommanderFormulaRepositoryStandard:
      • formulas/apache_formula.dart
  • Fix formula class name to DockerCommanderFormula
  • Adjust README.md to show a formula example.

2.0.3 #

  • Remove container: added force parameter.
  • Create/run container: added health check parameters.
  • DockerCommanderConsole:
    • Added command remove-container:
  • Initial version of formulas: DockerCommanderFormular.
  • apollovm: ^0.0.14
    • Parses and executes formulas.

2.0.2 #

  • Dockerfile: using AOT (native) compilation to execute the server, with better response time and memory management.

2.0.1 #

  • Null Safety adjustments.
  • Fix ConsoleCMD parse of properties.
  • Improve read of container ID.

2.0.0 #

  • Dart 2.12.0:
    • Sound null safety compatibility.
    • Update CI dart commands.
    • sdk: '>=2.12.0 <3.0.0'
  • swiss_knife: ^3.0.6
  • mercury_client: ^2.0.2
  • logging: ^1.0.1
  • collection: ^1.15.0

1.0.23 #

  • Added DockerHostServer.checkAuthenticationBasicSecurity.

1.0.22 #

  • Fix version self reference.

1.0.21 #

  • Improve console log command output.

1.0.20 #

  • Improve console stdout/stderr output.
  • Dockerfile: --server and --console modes.
  • README.md: improved Docker image usage.

1.0.19 #

  • Improve console commands.
  • Dart 2.12.0+ compliant: change DockerFile to use dart run instead of dart pub run.

1.0.18 #

  • Added executable docker_commander_console: a console terminal to control a docker_commander_server.
  • Fix DockerHostRemote output consumer.
  • README: Improve Docker Image usage.
  • Dart 2.12.0+ compliant: dartfmt and dartanalyzer.
  • swiss_knife: ^2.5.26
  • mercury_client: ^1.1.19

1.0.17 #

  • docker_commander_server.dart: better console output.
  • Fixed path dependency.
  • README: Added Docker Image usage.

1.0.16 #

  • Improve live mapping of hosts in the same network: avoid mapping of already mapped hosts.
  • Added executable docker_commander_server.
  • Added Dockerfile for Docker Hub integration and docker_commander/server image.
  • Fixed server response issue to encode UTF-8 characters.

1.0.15 #

  • Added support to containers and services logs.
  • DockerProcess: now has a dispose method, to finish any stdout/stderr consumer/client.

1.0.14 #

  • Force usage of cidfile for better id resolution.
  • Add Swarm mode and Services support.
  • Added Swarm tests.

1.0.13 #

  • Add support to create a container and start it.
  • Add volume parameters for run and createContainer.

1.0.12 #

  • Improve example.
  • Improve README.
  • Improve documentation.
  • Fix typo.

1.0.11 #

  • Improve NGINX integration.
  • Improve README.
  • DockerHostRemote: ensure that waitReady is called in initialization.

1.0.10 #

  • NginxContainer: NGINX container with a NginxReverseProxyConfigurer.
  • Added support to include in each container of the same network the IP of other hosts.
  • Added command helpers execShell, putFile and appendFile.
  • Added helpers to wait data in stdout/stderr: waitData waitForDataMatch.
  • Fix remote operations: wait_ready and wait_exit.

1.0.9 #

  • DockerHost.run and DockerHost.exec:
    • exposed parameter outputReadyType.
  • Fixed DockerProcessRemote and DockerRunnerRemote to use local resolution of output ready state.
  • Fixed sync of outputs of DockerProcessRemote:
    • now retries in case of network error and also finalizes sync loop, also checking if DockerProcessRemote was finished.
  • Fixed read of --cidfile: now waits for the CID file to exist.
  • Added ApacheHttpdContainer example to README.md.

1.0.8 #

  • Fix stop command for DockerHostRemote and DockerHostServer.

1.0.7 #

  • Added support for Docker exec.
    • DockerProcess: to handle exec calls.
    • execWhich: to facilitate binary path resolution inside containers.
    • execCat: to cat a file inside the container.
  • Added ApacheHttpdContainer, to run a pre-configure Apache HTTPD.
  • Improved Output and OutputStream:
    • Correctly detects that associated DockerProcess exited.
    • Improved ready state with OutputReadyType.
    • DockerHostRemote: OutputClient now sleeps when sync doesn't receive data, to reduce number of calls.

1.0.6 #

  • Change libraries:
    • docker_commander.dart: standard and portable, even works in the browser through DockerHostRemote.
    • docker_commander_vm.dart: VM exclusive features, like DockerHostLocal and DockerHostServer.
  • Fix Server token validation and ensure authentication in all operations.

1.0.5 #

  • Fix libraries names.

1.0.4 #

  • Fix library exports.
  • Added timeout parameters to stop methods.
  • Organize imports.
  • Improved README.md examples.

1.0.3 #

  • Added support to be used in the browser (only with DockerHostRemote).
  • DockerHost.run() new parameters:
    • imageArgs
    • ports
    • network
    • hostname
    • environment
  • Added DockerContainerConfig, for pre-configured containers.
  • Added PostgreSQLContainer, using pre-configured DockerContainerConfig.

1.0.2 #

  • Added DockerHostRemote and DockerHostServer.
  • DockerHost:
    • getRunnersInstanceIDs
    • getRunnersNames
    • getRunnerByInstanceID
    • getRunnerByName
    • stopByInstanceID
    • stopByName
    • stopRunners
  • DockerRunner:
    • isRunning
  • Tests now runs with loca and remote contexts.

1.0.1 #

  • Fix README.

1.0.0 #

  • Initial version.
16
likes
150
points
3.33k
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Docker manager for local and remote host machines. Works with personalized containers and pre-configured popular containers, like PostgreSQL, Apache HTTPD and NGINX.

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

apollovm, collection, logging, mercury_client, swiss_knife, version

More

Packages that depend on docker_commander