How to mount docker volume with jenkins docker container? : <p>I have jenkins running inside container and project source code on github.</p>

<p>I need to run project in container on the same host as jenkins, but not as docker-in-docker, i want to run them as sibling containers.</p>

<p>My pipeline looks like this:</p>

<ol>
<li>pull the source from github</li>
<li>build the project image</li>
<li>run the project container</li>
</ol>

<p>What i do right now is using the docker socket of host from jenkins container:</p>

<pre><code>/var/run/docker.sock:/var/run/docker.sock
</code></pre>

<p>I have problem when jenkins container mount the volume with source code from /var/jenkins_home/workspace/BRANCH_NAME to project container:</p>

<pre><code>volumes:
 - ./servers/identity/app:/srv/app
</code></pre>

<p>i am getting empty folder "/srv/app" in project container</p>

<p>My best guess is that docker tries to mount it from host and not from the jenkins container.</p>

<p>So the question is: how can i explicitly set the container from which i mount the volume? </p>
