Docker volumes mounting on Windows 8 is not working

Viewed 2073

Context

I want to run a Docker Compose application on a Windows 8. I made it under a Ubuntu 16.04 and it's perfectly working on it.

This Docker Compose run:

  • nginx
  • php-fpm

The two containers use volumes.

Files

My .env file:

COMPOSE_CONVERT_WINDOWS_PATHS=1
APPLICATION_PATH=//C/Users/my_user/Documents/Development/my_application

My docker-compose.yml file:

version: '2'

services:
  web:
    build: ../application-web/
    ports:
     - "80:80"
    tty: true
    # Add a volume to link php code on the host and inside the container
    volumes:
     - ${APPLICATION_PATH}:/usr/share/nginx/html/application
     - ${APPLICATION_PATH}/docker_files/docker-assistant:/usr/share/nginx/html/assistant
    # Add hostnames to allow devs to call special url to open sites
    extra_hosts:
     - "localhost:127.0.0.1"
     - "assistant.docker:127.0.0.1"
     - "application.dev:127.0.0.1"
    depends_on:
     - custom-php
    links:
     - custom-php:custom-php

  custom-php:
    build: ../application-php/
    ports:
     - "50:50"
    volumes:
     - ${APPLICATION_PATH}:/usr/share/nginx/html/application
     - ${APPLICATION_PATH}/docker_files/docker-assistant:/usr/share/nginx/html/assistant

Problem

When I run docker-compose up, everything goes well. Containers start. But when I try to reach http://192.168.99.100 in my web browser, I got a 403 error.

My investigations show that there is no mounted volumes in the nginx and the php containers:

docker exec -it compose_web_1 bash
ls -la /usr/share/nginx/html/assistant/

shows

drwxr.xr.x 2 root root   80 May 18 15:30 .
drwxr.xr.x 2 root root 4096 May 18 16:10 ..

It seems that Docker cannot mount volumes. Why?

Other information

  • I am using the Docker Toolbox: https://www.docker.com/products/docker-toolbox
  • I know that's the good IP address because when I try to reach it in my web browser, I see my nginx container displaying logs.
  • The environment variable APPLICATION_PATH set as //C:/Users/my_user/Documents/Development/my_application cannot work because Docker use the ":" character as separator for volume declaration:

    ERROR: Volume //C:/Users/my_user/Documents/Development/my_application://C:/Users/my_user/Documents/Development/my_application has incorrect format, should be external:internal[:mode]

  • It's not a nginx problem because when I create an index.phtml file in the folder, I am able to run it:

    <?php
    echo 'Hello world!';
    
1 Answers
Related