【问题标题】:docker not found when i run Jenkins pipeline with Dockerfile for building spring-boot app当我使用 Dockerfile 运行 Jenkins 管道以构建 spring-boot 应用程序时,找不到 docker
【发布时间】:2020-06-28 12:59:18
【问题描述】:
pipeline 
{
    environment 
    {
        registryCredential = "DOCKER"
    }
    agent any
    tools {
        maven 'maven-app'
    }
    stages {
        stage ('Initialize') {
            steps {
                sh '''
                    echo "PATH = ${PATH}"
                    echo "M2_HOME = ${M2_HOME}"
                '''
            }
        }
        stage ('Build') {
           steps {
                sh 'mvn -Dmaven.test.failure.ignore=true clean install' 
            }
            post {
                success {
                    junit 'target/surefire-reports/**/*.xml' 
                }
            }
        }
        stage('Load') {
            steps{
                script {
                    app = docker.build("dantesh/simple-spring")
                    }
                }
            post{
                success{
                    echo "Docker Image created Successfully"
                }
                failure{
                    echo "Docker Image not created Successfully"
                }
            }    
        
        }        
    }
}

Below is the error i could see in pipeline

我已经在我的机器上安装了 docker-desktop,我可以从终端运行 docker 命令,但我无法从 Jenkins 管道运行 docker 命令,并且我在 全局工具配置 中添加了 docker 详细信息>

【问题讨论】:

    标签: jenkins jenkins-pipeline dockerfile


    【解决方案1】:

    尝试将 Jenkins 用户添加到 docker 组,然后运行您的管道。

    请在Post-installation steps for Linux中找到说明

    【讨论】:

      猜你喜欢
      • 2018-11-18
      • 1970-01-01
      • 2021-09-02
      • 2019-12-25
      • 2021-11-01
      • 2021-07-26
      • 1970-01-01
      • 2021-08-26
      • 2021-05-23
      相关资源
      最近更新 更多