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
• 18,520 points
2,599 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
• 52,350 points

Related Questions In Docker

+1 vote
1 answer

How to run jenkins service inside docker container?

Hi@akhtar, By default systemctl command will not run ...READ MORE

answered May 12, 2020 in Docker by MD
• 95,460 points
5,913 views
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
2,441 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,980 points
959 views
+2 votes
1 answer
+2 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
• 58,020 points
2,728 views
+15 votes
19 answers

How can I run a ‘docker exec’ command inside a docker container?

you can run any command in a ...READ MORE

answered Dec 10, 2018 in Docker by Pramiti
1,229,680 views
+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,220 points

edited Oct 16, 2018 by lina 34,191 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP