<p>I have a Jenkins instance setup using Googles <a href="https://cloud.google.com/solutions/jenkins-on-kubernetes-engine-tutorial" rel="nofollow noreferrer">Jenkins on Kubernetes</a> solution. I have not changed any of the settings of the Kubernetes Pod.</p>

<p>When I trigger a new job I am successfully able to get everything up and running until the point of my tests.</p>

<p>My tests use docker-compose. First I make sure to install docker (1.5-1+b1) and docker-compose (1.8.0-2) on the instance (I know I can optimize this by using an image that already includes these, but I am still just in proof-of-concept). </p>

<p>When I run the <code>docker-compose up</code> command everything works and the services start their initialization scripts. However, <strong>the mounts are empty</strong>. I have verified that the files exist on the Jenkins slave, and the mount is created inside the docker service when I run docker-compose, however <strong>they are empty</strong>. </p>

<p>Some information:</p>

<p>In order to get around file permissions I am using <code>/tmp</code> as the Jenkins Workspace. I am using SCM to pull my files (successfully) and in the docker-compose file I specify <code>version: '2'</code> and the mount paths with absolute paths. The volume section of the service that fails looks like this:</p>

<pre><code>volumes:
 - /tmp/automation:/opt/automation
</code></pre>

<p>I changed the command that is run in the service to <code>ls /opt/automation</code> and the result is an empty directory. </p>

<p><strong>What am I missing?</strong> <em>I just want to mount a directory into my docker-compose service</em>. This works perfectly from Windows, Ubuntu, and Centos devices. Why won't it work using the Kubernetes instance? </p>

Inbar Rose
<p>I found the reason it fails <a href="https://stackoverflow.com/a/31381323/1561176">here</a>:</p>
<blockquote>
<p>A Docker container in a Docker container uses the parent HOST's Docker daemon and hence, any volumes that are mounted in the &quot;docker-in-docker&quot; case is still referenced from the HOST, and not from the Container.</p>
<p>Therefore, the actual path mounted from the Jenkins container &quot;does not exist&quot; in the HOST. Due to this, a new directory is created in the &quot;docker-in-docker&quot; container that is empty. Same thing applies when a directory is mounted to a new Docker container inside a Container.</p>
</blockquote>
<p>So it seems like it will be impossible to mount something from the outer docker into the inner docker. And another solution must be found.</p>
