Jenkins - Helm - Docker not found when try to run a test

8/4/2018

Currently, I'm using Helm and Terraform to deploy my Jenkins on GCP. It is my terraform code:

variable "project_id" { default = "vision40-teste" }
variable "region" { default = "us-central1-a" }

variable "plugins" { default = [
  "kubernetes:1.12.0",
  "workflow-job:2.23",
  "workflow-aggregator:2.5",
  "credentials-binding:1.16",
  "git:3.9.1",
  "blueocean:1.7.1"
]}

provider "google" {
  version = "~> 1.0"
  region  = "${var.region}"
  project = "${var.project_id}"
}

resource "helm_release" "jenkins" {
  name      = "jenkins"
  chart     = "stable/jenkins"

  set {
    name  = "Master.AdminUser"
    value = "someuser"
  }

  set {
    name  = "Master.AdminPassword"
    value = "somepassword"
  }

  set {
    name = "Master.InstallPlugins"
    value = "{${join(",", var.plugins)}}"
  }

  set {
    name = "Agent.AlwaysPullImage"
    value = true
  }

  set {
    name = "Agent.Image"
    value = "adriagalin/jenkins-jnlp-slave"
  }

  set {
    name = "Agent.ImageTag"
    value = "latest"
  }
}

But when I try to run some docker command on pipeline I get this error:

[vision_front_new_master-PTH4UDTQVSAS7VICPCO2UFHIE5M6B37LQYLEJT5BMAT36AYX77KA] Running shell script

  • docker pull node:carbon

/home/jenkins/workspace/vision_front_new_master-PTH4UDTQVSAS7VICPCO2UFHIE5M6B37LQYLEJT5BMAT36AYX77KA@tmp/durable-e821ca88/script.sh: 2: /home/jenkins/workspace/vision_front_new_master-PTH4UDTQVSAS7VICPCO2UFHIE5M6B37LQYLEJT5BMAT36AYX77KA@tmp/durable-e821ca88/script.sh: docker: not found

script returned exit code 127

I tried to use other image for the agent but it stills not working.

-- Bruno Quaresma
docker
jenkins
kubernetes-helm

1 Answer

8/7/2018

I updated my values.yaml to use

Master:
  AdminUser: user
  AdminPassword: user
  InstallPlugins:
   - kubernetes:1.12.0
   - workflow-job:2.23
   - workflow-aggregator:2.5
   - credentials-binding:1.16
   - git:3.9.1
   - blueocean:1.7.1 
Agent:
  Image: adriagalin/jenkins-jnlp-slave
  ImageTag: 1.4
  AlwaysPullImage: true
  volumes:
   - type: HostPath
     volumeName: docker-sock
     hostPath: /var/run/docker.sock
     mountPath: /var/run/docker.sock
-- Bruno Quaresma
Source: StackOverflow