0

I'm running Jenkins as a container and for some reason Im having issues :D.

After the pipeline runs docker build -t testwebapp:latest . I get docker: Exec format error on the Build image stage

The pipeline command docker.build seems to do what it should so something is wrong with my env?

The Jenkins docker-compose include the docker.sock so the running jenkins should be allowed to piggyback of the host docker?

volumes:
    - /var/run/docker.sock:/var/run/docker.sock

Pipeline script defined in Jenkins:

pipeline {
    agent any
    stages {
        
        stage('Initialize Docker') {
            steps {
                script {
                    def dockerHome = tool 'myDocker'
                    env.PATH = "${dockerHome}/bin:${env.PATH}"
                }
            }
        }
        
        stage('Checkout') {
            steps {
                git branch: 'main', url: 'github url'
            }
        }

        stage('Build image') {
            steps {
                script {
                    docker.build("testwebapp:latest")
                }
            }
        } 
    }
    
    post {
        failure {
            script {
                currentBuild.result = 'FAILURE'
            }
        }
    }
}

The global tool configuration is pretty standard:

Jenkins global tool config

bobby2947
  • 27
  • 2
  • 5

0 Answers0