Docker compose not mounting volumes

Just setup docker toolbox in Windows 10 and I am having a little issue with my docker containers. When I do docker-compose up, the instance will start but nothing is mounted in my /var/www/html directory. If I open Kitematic I see the container and when I click on volumes I do not see the local folder set. Here is what my docker-compose.yml looks like.

web:
    build: .
    ports:
        - "80:80"
    volumes:
        - app/:/var/www/html/

Do I need to specify the absolute path to my local directory? The app directory is in the same folder as the docker-compose.yml file.

  • Instance only when needed - GCP
  • Docker java api maven Build error: busybox is an unrecognized image. Please pull the image first
  • Nginx returns HTTP Status 200 instead 302 on a proxy_pass configuration
  • WordPress Docker Proxy Error 502 : The proxy server received an invalid response from an upstream server
  • Dockerfile make error code 2
  • Jersey Grizzly HTTP Server shutdown inside container docker
  • Docker - OS X forward localhost 22 port to container 2022 port
  • Can a docker process access programms on the host with ipc
  • docker swarm container connect to host port
  • prevent Docker from exposing port on host
  • After deleting container from Azure Container Service agent, its website still available
  • Docker Namespace in kernel level
  • 2 Solutions collect form web for “Docker compose not mounting volumes”

    In addition to @VonC answer, it’s different when using docker-compose since the docs mention

    You can mount a relative path on the host, which will expand relative
    to the directory of the Compose configuration file being used.
    Relative paths should always begin with . or ..

    Do I need to specify the absolute path to my local directory?

    Yes. The doc mentions:

    The host-dir can either be an absolute path or a name value.

    • If you supply an absolute path for the host-dir, Docker bind-mounts to the path you specify.
    • If you supply a name, Docker creates a named volume by that name.

    In your case, app/ would be considered as a name, not as a host folder.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.