DEV Community

Install Jenkins using Docker Compose

Andres on May 05, 2020

What is Jenkins? Jenkins is an open source automation tool written in Java with plugins built for Continuous Integration purpose. It is ...
Collapse
 
paranoiasystem profile image
Marco Ferraioli • Edited

hello I have add this

- /usr/bin/docker-compose:/usr/bin/docker-compose

to my docker-compose file but when I run a docker-compose -v get this error to me

+ docker-compose -v
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 15, in <module>
    from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Enter fullscreen mode Exit fullscreen mode
Collapse
 
oaztech profile image
Oussama ANDALOUSSI

use this cmd "whereis docker-compose" to find location of docker-compose befor mapped to jenkins container

Collapse
 
paranoiasystem profile image
Marco Ferraioli

I have reinstalled docker-compose and now work

Collapse
 
ks profile image
ks • Edited

Great article, thank you for sharing.

I tried to set-up Jenkins using docker-compose you provided, and it works but I am unable to use docker commands inside my pipeline, instead receiving error:

docker build -t 547caf1aa35d1cb405cd7c5f91ce564aca862ad8 -f Dockerfile .

/var/jenkins_home/workspace/name@tmp/durable-7666a900/script.sh: 1: /var/jenkins_home/workspace/name@tmp/durable-7666a900/script.sh: docker: Permission denied

I checked again and I have all 3 volumes set correctly.
Any idea what might be the issue?

Collapse
 
ks profile image
ks

I managed to solve this by changing one of the volumes to:

 - /usr/bin/docker:/usr/bin/docker
Collapse
 
mojtabad profile image
Mojtaba Darvishi

Thanks, this helped me

Collapse
 
burdier profile image
Burdier • Edited

Hello there, I hope you are doing well. In my case when I try to run a docker image(docker run hello-world) I get this message:
/var/jenkins_home/workspace/myproject_test@tmp/durable-81e309a3/script.sh: 1: /var/jenkins_home/workspace/myproject_test@tmp/durable-81e309a3/script.sh: docker: Permission denied


Collapse
 
edarioq profile image
Edgar Quintero • Edited

Is the ~/jenkins:/var/jenkins_home really necessary ? Or can this all exist in Docker ?

Collapse
 
edarioq profile image
Edgar Quintero • Edited

8081 is already in use by Docker. I changed to 8080:8080 and it seems to work.

Collapse
 
coldestheart profile image
Ilia (COLD)

Big thanks man! its really good tutorial

Collapse
 
moatazabdalmageed profile image
Moataz Mohammady

Thanks it works well.