We have previously been running Jenkins in [Docker in Docker](https://github.com/jpetazzo/dind) (DIND) mode, i.e. running a docker daemon inside the Jenkins docker container. But due to many problems (some of which are described in the link above) we've decided to move away from this approach and instead let the container use the host daemon by simply mounting it as volume when starting the container:

```
-v /var/run/docker.sock:/var/run/docker.sock

```

But now we run into problems when mounting relative paths with [Docker Compose](https://docs.docker.com/compose/) that is started inside the *container* which worked fine in DIND mode. Consider this docker-compose file:

```
myimage:
  build: .
  environment:
     LANG: C.UTF-8     
  working_dir: /code
  volumes:
    - ../../../:/code
    - ~/.m2/repository:/root/.m2/repository
    - ~/.gradle:/root/.gradle

```

Previously this mounted all folders, for example the `../../../` folder, from the *container* but now it seems to try to mount them from the *host*. When I check the directory structure on the host it seems like `docker-compose` have replicated the directory structure from the container and then tries to mount this folder which makes it empty.

So my question is, how can one mount relative paths in Docker Compose when using the docker daemon from the host?