ES Docker with Jenkins

I'm running into a few issues with the ES maintained docker image and getting it to run within a Jenkins pipeline. If I run the container manually via the docker run command it works correctly; I am able to use docker exec to run commands against the container, and if I expose port 9200 I'm able to execute commands to the API. Once I move it into my pipeline though, I have been unable to interact with ES and after a lot of troubleshooting I've discovered it's not actually running the service.

My pipeline is pretty basic, it looks like this:

#!/usr/bin/env groovy

pipeline {

  agent {
    docker {
      image 'docker.elastic.co/elasticsearch/elasticsearch:5.6.5'
      args '-u root'
    }
  }

  stages {
    stage('Build') {
      steps {
        echo 'Building...'
      }
    }
  }
  post {
    always {
      script {
        sh 'curl -uelastic:changeme http://localhost:9200/'
      }
    }
  }
}

I know this might not be an ES issues specifically, but does has anyone run into something similar, or have any ideas what might be stopping ES from running within Jenkins?

Thanks~

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.