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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Traiano Welcome
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


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ada4fd69-1dbd-4f39-b940-3604d78e49d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Traiano Welcome

 Fixed this by simply moving the build off the master onto a slave.


On Wednesday, 12 July 2017 15:44:01 UTC+4, Traiano Welcome wrote:
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)" <a href="https://gcr.io" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://gcr.io&#39;;return true;" onclick="this.href=&#39;https://gcr.io&#39;;return true;">https://gcr.io
   gcloud docker -a
   docker push <a href="http://gcr.io/lol-prod/gceme:canary" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://gcr.io/lol-prod/gceme:canary&#39;;return true;" onclick="this.href=&#39;http://gcr.io/lol-prod/gceme:canary&#39;;return true;">gcr.io/lol-prod/gceme:canary

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

 Started by upstream project "<a href="http://35.190.33.95/job/gceme-code-fetch-build/" style="word-wrap:break-word;text-decoration:underline;color:rgb(92,53,102)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F35.190.33.95%2Fjob%2Fgceme-code-fetch-build%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGoByleF1gjjZSS1qVepvCtDflh1Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F35.190.33.95%2Fjob%2Fgceme-code-fetch-build%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGoByleF1gjjZSS1qVepvCtDflh1Q&#39;;return true;">gceme-code-fetch-build" build number <a href="http://35.190.33.95/job/gceme-code-fetch-build/13" style="word-wrap:break-word;text-decoration:underline;color:rgb(92,53,102)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F35.190.33.95%2Fjob%2Fgceme-code-fetch-build%2F13\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHPs9v6cFJ5__oK-CJXEZ30-VJPxQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F35.190.33.95%2Fjob%2Fgceme-code-fetch-build%2F13\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHPs9v6cFJ5__oK-CJXEZ30-VJPxQ&#39;;return true;">13
 originally caused by:
  Started by user <a href="http://35.190.33.95/user/jenkins" style="word-wrap:break-word;text-decoration:underline;color:rgb(92,53,102)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F35.190.33.95%2Fuser%2Fjenkins\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEnKnZnMDYrpVxn9A-kjSWhjFQVkw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F35.190.33.95%2Fuser%2Fjenkins\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEnKnZnMDYrpVxn9A-kjSWhjFQVkw&#39;;return true;">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  <a href="https://gcr.io/" style="word-wrap:break-word;text-decoration:underline;color:rgb(92,53,102)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://gcr.io/&#39;;return true;" onclick="this.href=&#39;https://gcr.io/&#39;;return true;">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


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c95b98f7-000b-4b64-8b05-5d074a665b31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...