Class StopContainerTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
io.github.pgatzka.docker.task.DockerTask
io.github.pgatzka.docker.task.container.StopContainerTask
All Implemented Interfaces:
Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>

@UntrackedTask(because="Docker daemon side effects must always run") public abstract class StopContainerTask extends DockerTask
Stops a running Docker container, waiting up to the configured timeout for graceful shutdown before the daemon escalates to SIGKILL.

Idempotent: a no-op when the container is absent or already stopped, and tolerates the benign race where the container exits between the inspect and stop calls. Marked UntrackedTask because the daemon side effect must always run.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.gradle.api.Named

    org.gradle.api.Named.Namer
  • Field Summary

    Fields inherited from interface org.gradle.api.Task

    TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Invoked by Gradle's bytecode-decorated subclass; not for direct use.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Gradle entry point for this task.
    abstract org.gradle.api.provider.Property<String>
    Mirrors ContainerSpec.name: the container name on the daemon.
    abstract org.gradle.api.provider.Property<Duration>
    Mirrors ContainerSpec.stopTimeout: the grace period before the daemon escalates to SIGKILL.

    Methods inherited from class io.github.pgatzka.docker.task.DockerTask

    getDockerService

    Methods inherited from class org.gradle.api.DefaultTask

    compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService

    Methods inherited from class org.gradle.api.internal.AbstractTask

    acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjects

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, notCompatibleWithConfigurationCache
  • Constructor Details

    • StopContainerTask

      public StopContainerTask()
      Invoked by Gradle's bytecode-decorated subclass; not for direct use.
  • Method Details

    • getContainerName

      @Input public abstract org.gradle.api.provider.Property<String> getContainerName()
      Mirrors ContainerSpec.name: the container name on the daemon.
      Returns:
      the container name property
    • getStopTimeout

      @Input public abstract org.gradle.api.provider.Property<Duration> getStopTimeout()
      Mirrors ContainerSpec.stopTimeout: the grace period before the daemon escalates to SIGKILL.
      Returns:
      the stop timeout property
    • execute

      public void execute()
      Gradle entry point for this task. Delegates to the package-private run(DockerClient, String, Duration, Logger) helper.