I finally answered my own question and documented here: https://nemerosa.ghost.io/2016/09/27/docker-in-docker-in-jenkins-pipeline/
I hope it helps other people. Best regards, Damien. On Monday, 26 September 2016 21:27:00 UTC+2, Damien Coraboeuf wrote: > > Hi, > > After having struggled, I decided to create a simplified version of a > pipeline, which highlights the issue. > > Environment: Linux, Jenkins 2.23, latest versions of the pipeline > components. > > Given the pipeline definition at > https://github.com/nemerosa/jenkins-docker: > > 1. I build a Docker image which allows to run Postgres PSQL client, > Docker & Docker Compose > 2. I run it with '--volume=/var/run/docker.sock:/var/run/docker.sock' > as arguments, to be able to run in the same Docker environment > 3. I run a serie a bash commands inside this container > 4. the first action I do is to create a Postgres container using > Docker Compose > 5. I can get the port of the created Postgres container, no problem > 6. I then try to connect to the Postgres container - but which host > can I use? > > As mentioned, this is a simplification of a more complex case, but the > general idea is a build which creates its own containers (like a database) > and tries to connect to it to perform some tests. But this build runs > itself in Docker container and does not seem able to reach the other > containers on the specified port. I've tried localhost, ${NODE_NAME}. > Nothing was worked so far. > > The > https://wiki.jenkins-ci.org/display/JENKINS/CloudBees+Docker+Custom+Build+Environment+Plugin > > is supposed to put DOCKER_HOST available for such a purpose, but this does > not seem available any longer when in the pipeline. > > Can someone help me resolve this problem? > > Thanks, > Damien. > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6d93d9ff-32d3-4898-9edd-75e697919eb9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.