docker library

Helper for Docker cmdline operations.

Mainly thought as a helper-library for Grinder

@Task("Stops containers")
dockerStopp() {
    ["db-webappbase-test", "db-mobiad-test"].forEach((final String container) {
        log("Stopping container: $container");
        new Docker()..stop([container ],quiet: true);
    });
}

@Task("Start container")
@Depends(dockerStopp)
dockerStart() {
    new Docker()..start([ "db-webappbase-test" ],quiet: true);
}

@Task("Check if container runs and if container is available")
containerCheck() async {
    final Docker docker = new Docker();

    [ "db-mobiad-test"].forEach((final String name) => docker.stop([ name ]));
    docker.start([ containerNameToCheck] );

    final Container container = new Container(runningContainerIDs());
    if(!container.names.contains(containerNameToCheck)) {

        container.names.forEach((final String name) {
            log("Active containers: -${name}-");
        });

        throw new ArgumentError("${containerNameToCheck} must be running for this test!");
    }
}

Classes

Container
Wrapper for Docker containers [...]
Docker
Synchronously runs the "docker" command. [...]
DockerRunOptions
Arguments passed to Docker.run. See Docker.run for more details.

Functions

allContainerIDs({Docker docker: const Docker() }) UnmodifiableListView<String>
Returns all Docker-Container-IDs
runningContainerIDs({Docker docker: const Docker() }) UnmodifiableListView<String>
Returns Docker-Container-IDs for active/running containers