jenkins kubernetes plugin execution issues

1/21/2019

I am running Jenkins on EKS with Kubernetes plugin. I have one cloud setup, and a template running my own container image for alpine with docker ( to execute docker commands )

i have only 1 job currently that only does "docker service ls" as bash i get the error

"/tmp/jenkins8475081645730667159.sh: line 2: docker: command not found"

while going inside the container using exec and switching to "jenkins" user i am able to run "docker".

it looks like my pod contains both jnlp container and my alpine-docker container-when write to file , it will write it to the alpine container while if i run "docker" it will try to run it on the jnlp container, does this make any sense ? Thanks

-- MrOps
docker
jenkins
kubernetes

1 Answer

1/30/2019

you have to run docker from your container

In your pipeline

      container('mycontainer') {
        sh 'docker service ls'
      }

You can't use a container other than the jnlp one if you are using freestyle jobs, only pipeline jobs

-- csanchez
Source: StackOverflow