The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.

Docker plugin

dockerNode: Docker Node (⚠️ Experimental)

Allocates a new Jenkins agent using a specified Docker image and runs tasks on it. Example:

docker-node(image: 'cloudbees/jnlp-slave-with-java-build-tools') {
    git 'https://github.com/jglick/simple-maven-project-with-tests'
    withMaven {
        sh 'mvn install'
    }
}
  • dockerHost
    • Type: String
  • image
    • Type: String
  • connector (optional)
      Nested Choice of Objects
    • attach
      • user (optional)
        User under that jenkins slave will be run. "root" if not specified.
        • Type: String
    • jnlp
      • jnlpLauncher
          Nested Object
        • tunnel
          • Type: String
        • vmargs
          If the agent JVM should be launched with additional VM arguments, such as "-Xmx256m", specify those here. List of all the options are available here.
          • Type: String
      • entryPointArgumentsString (optional)
        • Type: String
      • jenkinsUrl (optional)
        If needed, the Jenkins URL can be overwritten with this property (e.g. to support other HTTP(S) endpoints due to reverse proxies or firewalling). By default the URL from the global Jenkins configuration is used.
        • Type: String
      • user (optional)
        User under that jenkins slave will be run. "root" if not specified.
        • Type: String
    • ssh
      • sshKeyStrategy
        Define how a SSH key pair is configured for ssh authentication in container.
          Nested Choice of Objects
        • $class: 'InjectSSHKey'
          • user
            Injected SSH key will let agent start as root in container. If you want to use another user configure it's name here. Plase note such a user must pre-exist in container image.
            • Type: String
        • $class: 'ManuallyConfiguredSSHKey'
          • credentialsId
            • Type: String
          • sshHostKeyVerificationStrategy
              Nested Choice of Objects
            • $class: 'KnownHostsFileKeyVerificationStrategy'
            • Checks the known_hosts file (~/.ssh/known_hosts) for the user Jenkins is executing under, to see if an entry exists that matches the current connection.

              This method does not make any updates to the Known Hosts file, instead using the file as a read-only source and expecting someone with suitable access to the appropriate user account on the Jenkins master to update the file as required, potentially using the ssh hostname command to initiate a connection and update the file appropriately.

              • $class: 'ManuallyProvidedKeyVerificationStrategy'
              • Checks the key provided by the remote host matches the key set by the user who configured this connection.

                • key

                  The SSH key expected for this connection. This key should be in the form `algorithm value` where algorithm is one of ssh-rsa or ssh-dss, and value is the Base 64 encoded content of the key.

                  • Type: String
              • $class: 'ManuallyTrustedKeyVerificationStrategy'
              • Checks the remote key matches the key currently marked as trusted for this host.

                Depending on configuration, the key will be automatically trusted for the first connection, or an authorised user will be asked to approve the key. An authorised user will be required to approve any new key that gets presented by the remote host.

                • requireInitialManualTrust

                  Require a user with Computer.CONFIGURE permission to authorise the key presented during the first connection to this host before the connection will be allowed to be established.

                  If this option is not enabled then the key presented on first connection for this host will be automatically trusted and allowed for all subsequent connections without any manual intervention.

                  • Type: boolean
              • $class: 'NonVerifyingKeyVerificationStrategy'
              • Does not perform any verification of the SSH key presented by the remote host, allowing all connections regardless of the key they present.

          • javaPath (optional)
            • Type: String
          • jvmOptions (optional)
            • Type: String
          • launchTimeoutSeconds (optional)
            • Type: int
          • maxNumRetries (optional)
            • Type: int
          • port (optional)
            • Type: int
          • prefixStartSlaveCmd (optional)
            • Type: String
          • retryWaitTime (optional)
            • Type: int
          • suffixStartSlaveCmd (optional)
            • Type: String
      • credentialsId (optional)
        • Type: String
      • remoteFs (optional)
        • Type: String

      Was this page helpful?

      Please submit your feedback about this page through this quick form.

      Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?

          


      See existing feedback here.