build docker container inside dockerized Jenkins

21 views
Skip to first unread message

Jeeva Chelladhurai

unread,
Jun 6, 2017, 10:03:48 AM6/6/17
to jenkins...@googlegroups.com
I run by Jenkins inside a docker container. Now I need to build docker images from this Jenkins instance. Would you please suggest me some options.

--
Jeeva K S Chelladhurai

nicolas de loof

unread,
Jun 6, 2017, 10:15:53 AM6/6/17
to jenkins...@googlegroups.com
When you're running Jenkins in a container don't build on master, always connect a slave. This slave can also be a container. Doing this you'll enforce process isolation.
To run docker commands like 'docker build' the commonly used approach is to bind mount /car/run/docker.sock. that's beer red wings if you just throw away security: build can do anything on host until you add another isolation layer, for sample a LXD container.

--
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 jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAK5CbZXmRA8w4to2zRO01KCz0QJcGQuY0azXLZQ5EBG%3DmDfJfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Jeeva Chelladhurai

unread,
Jun 6, 2017, 12:19:14 PM6/6/17
to jenkins...@googlegroups.com
currently I am using SSH slaves for building docker images. Is it a recommended practice?

How does Docker slave plugin works? Does function like a slave or piggyback on any of the existing slaves?
https://wiki.jenkins-ci.org/display/JENKINS/Docker+Slaves+Plugin


For more options, visit https://groups.google.com/d/optout.

nicolas de loof

unread,
Jun 6, 2017, 12:37:31 PM6/6/17
to jenkins...@googlegroups.com
docker-slaves don't follow the classic slave approach, it doesn't use any transport (ssh, jnlp) but the plain docker CLI terminal emulation. 

Jeeva Chelladhurai

unread,
Jun 6, 2017, 10:34:08 PM6/6/17
to jenkins...@googlegroups.com
> docker-slaves don't follow the classic slave approach, it doesn't use any transport (ssh, jnlp) but the plain docker CLI terminal emulation.

Does that mean I have to bind mount docker socket to the Jenkins container?

-Jeeva


For more options, visit https://groups.google.com/d/optout.

nicolas de loof

unread,
Jun 7, 2017, 1:01:03 AM6/7/17
to jenkins...@googlegroups.com
to use docker-slaves plugin you'll need docker socket or a DOCKER_HOST url set so master can run docker commands

Reply all
Reply to author
Forward
0 new messages