title: Docker in Docker cannot mount volume
body: <p>I am running a Jenkins cluster where in the Master and Slave, both are running as a Docker containers. </p>
  
  <p>The Host is latest boot2docker VM running on MacOS.</p>
  
  <p>To allow Jenkins to be able to perform deployment using Docker, I have mounted the docker.sock and docker client from the host to the Jenkins container like this :-</p>
  
  <pre><code>docker run -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v $HOST_JENKINS_DATA_DIRECTORY/jenkins_data:/var/jenkins_home -v $HOST_SSH_KEYS_DIRECTORY/.ssh/:/var/jenkins_home/.ssh/ -p 8080:8080 jenkins
  </code></pre>
  
  <p>I am facing issues while mounting a volume to Docker containers that are run inside the Jenkins container. For example, if I need to run another Container inside the Jenkins container, I do the following :-</p>
  
  <pre><code>sudo docker run -v $JENKINS_CONTAINER/deploy.json:/root/deploy.json $CONTAINER_REPO/$CONTAINER_IMAGE 
  </code></pre>
  
  <p>The above runs the container, but the file "deploy.json" is NOT mounted as a file, but instead as a "Directory". Even if I mount a Directory as a Volume, I am unable to view the files in the resulting container. </p>
  
  <p>Is this a problem, because of file permissions due to Docker in Docker case?</p>