Jenkins Docker Pipelining inside Docker

0 votes

I'm following along with this tutorial:

https://www.linkedin.com/pulse/building-docker-pipeline-cloudbees-jenkins-jay-johnson

I'm running Jenkins on Docker 17:

docker run -d -p 8080:8080 -p 50000:50000 --name jenkins jenkins

I followed the instructions and replaced Jay's credentials with my own. I added my creds to Global and then renamed the creds in the pipeline script. When I attempt the build, though I'm getting the following error:

Proceeding
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withDockerRegistry
Wrote authentication to /var/jenkins_home/.dockercfg
[Pipeline] {
[Pipeline] stage (Building)
Using the ‘stage’ step without a block argument is deprecated
Entering stage Building
Proceeding
[Pipeline] sh
[alfred-master] Running shell script
+ docker build -t jayjohnson/django-slack-sphinx:testing django
/var/jenkins_home/workspace/alfred-master@tmp/durable-713ce0d7/script.sh: 2: /var/jenkins_home/workspace/alfred-master@tmp/durable-713ce0d7/script.sh: docker: not found
[Pipeline] }
[Pipeline] // withDockerRegistry
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 127
Finished: FAILURE
Aug 1, 2018 in Docker by Hannah
• 14,070 points
335 views

1 answer to this question.

0 votes
The issue is here:

/var/jenkins_home/workspace/alfred-master@tmp/durable-713ce0d7/script.sh: 2: /var/jenkins_home/workspace/alfred-master@tmp/durable-713ce0d7/script.sh: docker: not found

I'm assuming your build is running on the master instance, which is just a basic installation of Jenkins - no extra tools.

You'll want to run an agent slave and connect it to your master - this agent should ensure it has Docker installed, and then you will be able to run those commands.
answered Aug 1, 2018 by Kalgi
• 40,460 points

Related Questions In Docker

0 votes
1 answer

Docker containers as Jenkins Slave build agents

When you encapsulate the stage inside a ...READ MORE

answered Jun 16, 2018 in Docker by Atul
• 10,240 points
656 views
0 votes
1 answer

Different file owner inside Docker container and in host machine Ask

Filesystems, at least in Unix- and Linux-like ...READ MORE

answered Jun 25, 2018 in Docker by Damon Salvatore
• 5,510 points
72 views
0 votes
1 answer

Different file owner inside Docker container and in host machine

Here is what you can try. Since ...READ MORE

answered Jun 27, 2018 in Docker by Atul
• 10,240 points
189 views
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,540 points
156 views
+1 vote
11 answers
+4 votes
4 answers

How To Access a Service on Host From a Docker Container?

Adding to kalgi's answer, You can also ...READ MORE

answered Oct 16, 2018 in Docker by lina
• 8,110 points

edited Oct 16, 2018 by lina 4,300 views