Cannot mount volume in docker

I am trying to use docker-compose to mount my local directory a new directory at the root level on my docker container. Supposedly this is quite a simple thing to do.

This is what my docker-compose file looks like:


version: '2'
services:
web:
build: ./docker/web/
expose:
- 80
volumes:
- .:/contracts

The Dockerfile in docker/web literally looks like this (I plan to do more later):

FROM php:5.6-apache
RUN /contracts/provision/web.sh

But I keep getting the error that web.sh cannot be found. Putting various ls commands and the like in my Dockerfile show that no such directory called “contracts” is being created on the container. If I try with an existing directly like mnt, I get the same result – the directory remains empty.

But a vagrant inspect shows that it is apparently mounted!

    "Mounts": [
        {
            "Type": "bind",
            "Source": "/vagrant",
            "Destination": "/contracts",
            "Mode": "rw",
            "RW": true,
            "Propagation": ""
        }
    ],

I am running docker-compose on a vagrant box running Ubuntu 14.04.

Any help would be hugely appreciated, I am at the end of my tether. Thanks!


Source: stackoverflow-php