how to build docker image using jenkins x

1/21/2019

I am trying to build docker Image using jenkins x and I have created kubernetes cluster using minikube. got an error /var/jenkins_home/workspace/sarika-ps_go-k8s_master@tmp/durable-6564436e/script.sh: docker: not found. I have installed the docker plugin on jenkins x. Please help me. Thanks

-- Sarika Jamdade
docker
dockerhub
jenkins--x
kubernetes
minikube

1 Answer

1/21/2019

what kind of project are you trying to build? If you try to import your code you'll hopefully find your project gets setup correctly.

basically Jenkins X uses build pods to run the pipelines which already have all the software tools required for pipelines (docker, skaffold, kubectl etc) inside the build pod which is defined as a docker image.

Try to reuse one of the existing build pods - e.g. using jenkins-maven as the build agent:

 pipeline {
  agent {
    label "jenkins-maven"
  }
  stages {
    stage('release') {
      steps {
        container('maven') {
          sh "docker build -t foo:bar ."
...

or you could try create a custom build pod.

-- James Strachan
Source: StackOverflow