Jenkins 管道异常 - 找不到 docker

Jenkins pipeline exception - Getting docker not found

我在 azure kubernetes 服务上 运行ning Jenkins 服务,我有简单的管道脚本来构建我的演示 angular 项目..

pipeline {
 agent any 
 stages {
 stage(‘Build’) {
        steps {
            checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'mygithub', url: 'https://github.com/prabaharanit/docker-angular-example']]])
        }
    }

 stage('Fetch dependencies') {
  agent {
    docker 'circleci/node:9.3-stretch-browsers'
  }
  steps {
    sh 'yarn'
    stash includes: 'node_modules/', name: 'node_modules'
  }
}
}
}

当我构建管道时出现以下错误,

/var/jenkins_home/workspace/worklist-pipeline@2@tmp/durable-ec84fb4d/script.sh: docker: not found.

如何让 Jenkins 使用我的主机 docker 容器进行构建..这是为了测试目的,我想使用我的主机 docker 来 运行 构建和创建图片.. 我尝试添加 docker 表单全局工具配置.. 但它不起作用。

为了使用你的 Jenkins 主机 docker 引擎。从管道中删除以下代理语句 -

  agent {
    docker 'circleci/node:9.3-stretch-browsers'
  }

PS - 只要您想使用 Jenkins 主机,就可以在该阶段使用 agent { label 'master' }