Pushing docker container from Jenkins pipeline stage: /tmp/hudson147937620201668461.sh: docker: not found

59 views
Skip to first unread message

Traiano Welcome

unread,
Jul 12, 2017, 7:44:01 AM7/12/17
to Jenkins Users
Hi All

I have  a jenkins pipeline step which simply logs in to google's docker container registry service and pushes the image.

The Build step is implemented as the following set of shell commands:

    cat >  ~/docker_key.json <<'endmsg'
    {
    .
    <some secret data>
    .

    }
   endmsg
   docker login -u _json_key -p "$(cat ~/docker_key.json)" https://gcr.io
   gcloud docker -a
   docker push gcr.io/lol-prod/gceme:canary

However, it fails with a "docker: not found" error:

 Started by upstream project "gceme-code-fetch-build" build number 13
 originally caused by:
  Started by user jenkins
 Building on master in workspace /var/jenkins_home/gcme
 [gcme] $ /bin/sh -xe /tmp/hudson147937620201668461.sh
 + cat
 + cat ~/docker_key.json
 + docker login -u _json_key -p  https://gcr.io
 /tmp/hudson147937620201668461.sh: 16: /tmp/hudson147937620201668461.sh: docker: not found
 Build step 'Execute shell' marked build as failure
 Warning: you have no plugins providing access control for builds, so falling back to legacy behavior of permitting any downstream   builds to be triggered
 Finished: FAILURE

NOTES:

1) Jenkins master is running as a docker image in Kubernetes
2) It uses a jenkins slave server which is an ec2 instance


Traiano Welcome

unread,
Jul 12, 2017, 10:47:09 AM7/12/17
to Jenkins Users

 Fixed this by simply moving the build off the master onto a slave.
Reply all
Reply to author
Forward
0 new messages