# Cannot mount a volume using docker-compose

**URL:** <https://forums.docker.com/t/cannot-mount-a-volume-using-docker-compose/37896>\
**Category:** General\
**Created:** [September 9, 2017, 2:26pm UTC](https://forums.docker.com/t/cannot-mount-a-volume-using-docker-compose/37896 "2017-09-09T14:26:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zoran119](https://avatars.discourse-cdn.com/v4/letter/z/e95f7d/32.png) [@zoran119](https://forums.docker.com/u/zoran119)\
**Post date:** [September 9, 2017, 2:26pm UTC](https://forums.docker.com/t/cannot-mount-a-volume-using-docker-compose/37896/1 "2017-09-09T14:26:07Z")

</div>

I have a project with the following structure:

```
- my-project/
  - docker-compose.yml
  - web
    - Dockerfile
    - src/

```

I am trying to setup docker-compose.yml, so that the `web` service will start up in a docker container, and `web/` directory will be mounted under `/app` in the docker container. This will enable me to edit the source files on the host system, and they will be recompiled in the docker container (let’s say this is a Rails app).

Currently my `docker-compose.yml` looks like this:

```
version: "2"
services:
    web:
        build: web
        image: web
        volumes:
            - ./web:/app

```

This `docker-compose.yml` does use `web/Dockerfile` to build the web image, and it starts it up, but `/app` directory in the running container is always empty. I cannot figure out why that’s the case. I can get what I want by using docker directly (by running the following in the `web/` directory: `docker run -v $(pwd)/web:/app -it --rm web /bin/bash`), but this is not going to work with multiple web-like services (hence why I’m trying to use `docker-compose`).

Can anyone see what is wrong here?

Some resources:

- [https://github.com/zoran119/haskell-webservice](https://github.com/zoran119/haskell-webservice) (sample project demonstrating my problem)
- [https://stackoverflow.com/questions/46131081/setting-up-docker-compose-for-development](https://stackoverflow.com/questions/46131081/setting-up-docker-compose-for-development) (my question about this on SO)
