Jenkins container with Docker container

38 views
Skip to first unread message

Kha Nguyen

unread,
Sep 16, 2015, 11:21:40 PM9/16/15
to Jenkins Users
I have a use case where I run Jenkins inside a container using this Jenkins official image. Then I also need Jenkins to build Docker images, and for that I also run another container, known as docker-in-docker, with this official image with tag 'dind'. After I have linked the docker-in-docker container with the Jenkins container, I can successfully ping the docker-in-docker container using the alias from the Jenkins container. However, I am unsure about how I can setup docker build for Jenkins. I installed the Docker build step plugin, which exposes an option to install Docker, and to connect to a Docker server. I config the install Docker option, and yet `docker` command is not available. I cannot really connect to the Docker server using the alias and port 2375.

Any help is really appreciated.

Baptiste Mathus

unread,
Sep 17, 2015, 12:59:49 AM9/17/15
to jenkins...@googlegroups.com

Hi,
Paraphrasing if you're using docker in docker, then think twice ;).

You certainly want to read https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/ (blog by the very author of DinD, hence obviously insightful).

Cheers

Le 17 sept. 2015 5:21 AM, "Kha Nguyen" <nlh...@gmail.com> a écrit :
I have a use case where I run Jenkins inside a container using this Jenkins official image. Then I also need Jenkins to build Docker images, and for that I also run another container, known as docker-in-docker, with this official image with tag 'dind'. After I have linked the docker-in-docker container with the Jenkins container, I can successfully ping the docker-in-docker container using the alias from the Jenkins container. However, I am unsure about how I can setup docker build for Jenkins. I installed the Docker build step plugin, which exposes an option to install Docker, and to connect to a Docker server. I config the install Docker option, and yet `docker` command is not available. I cannot really connect to the Docker server using the alias and port 2375.

Any help is really appreciated.

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b7b25a7e-acf2-458a-aa1e-6f067cd20e4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kha Nguyen

unread,
Sep 17, 2015, 1:28:04 AM9/17/15
to Jenkins Users
Wow! This is interesting! I wonder why this post never showed up in my Google search.

Kha Nguyen

unread,
Sep 17, 2015, 2:42:45 AM9/17/15
to Jenkins Users
So I ended up with the solution suggested in the article. There is one issue left unresolved though, and that issue is when I use the Docker socket from within the Jenkins container, the container does not have permission to use the socket. I ended up having to modify the permission on the Docker socket on the host machine. I have a working solution now, but it leaves more to desire.

Thanks for the article!


On Thursday, September 17, 2015 at 11:59:49 AM UTC+7, Baptiste Mathus wrote:
Reply all
Reply to author
Forward
0 new messages