Run Script in Docker Container

With this plugin, you can use a command to run a script in a running Docker container, without logging in to the container.

To configure the Run Script in Docker Container step:

  1. Add the Run Script in Docker Container step to a chain, as described in Create chains.

  2. Enter the plugin configuration details:

    Field Description
    Title Enter a name for the plugin step or accept the default name.
    Root context directory for script (Optional) Enter the root context directory, which normally contains the dockerfile for the image.
    Docker image name Enter the name of the Docker image where to run the script.
    Path to mount workspace (Optional) Enter the path within the container where to mount the workspace.
    Type of script Select to use either inline command or file path.
    Script language

    Select a script language:

    • Shell Script
    • Windows Batch
    • Windows PowerShell
    File path If you are using a file path, enter the path to the file that contains the command. Use single quotation marks to escape spaces in the path name.
    Command line If you are using inline command, enter the command you want to run.
    Advanced options

    (Optional) Specify additional Docker options:

    • Docker host. Enter the Docker host to use. Default: tcp://0.0.0.0:2376

    • Path to certificates on Agent. Enter the local file path to certificates on the agent.

    Automatically remove container Keep this option selected to automatically remove Docker container.
    Control options

    (Optional) Define the control options for the plugin step:

    • Enable step. By default, the step is enabled to run. Clear this option if you need to deactivate the step.

      Disabled steps are skipped when the chain runs.

    • Fail the step. Specify the conditions for failing the step, such as unit test failures, findings criteria, and/or console log entries.

    • Mark step as unstable. Specify the conditions for making the step unstable, such as unit test failures, findings criteria, and/or console log entries.

    Output variables (Optional) Specify the output variables to be passed to other steps down the chain. For details, see Publish output variables.

Back to top

See also: