Search code examples
dockerdocker-composenano-server

Docker Compose: Volumes not working on Windows Nano


I've got two Windows Nano docker containers ... one with a service on, the second with my Automated Acceptance Tests.

I'm trying to add a volume to the aat container so I can copy off the tests output.

I've seen elsewhere I'm supposed to use ...

  • COMPOSE_CONVERT_WINDOWS_PATHS=1

But can't seem to get anywhere :S

version: '3.3'

services:
  fancyservice:
    restart: always
    image: fancyservice
  aat-runner:
    environment:
      - FancyServiceUrl=http://fancyservice/
      - COMPOSE_CONVERT_WINDOWS_PATHS=1
    volumes:
      - .:/output:rw
    restart: always
    image: aat-runner

I get:

ERROR: for aat_aat-runner_1  Cannot create container for service aat-runner: invalid volume spec "/output"

ERROR: for aat-runner  Cannot create container for service aat-runner: invalid volume spec "/output": invalid volume specification: '\output'
ERROR: Encountered errors while bringing up the project.

Solution

  • You have to specify the volume at the same level as "services:" as well as against the individual container ...

    version: '3.3'
    
    services:
      fancyservice:
        restart: always
        image: fancyservice
      aat-runner:
        environment:
          - FancyServiceUrl=http://fancyservice/
          - COMPOSE_CONVERT_WINDOWS_PATHS=1
        volumes:
          - .:/output:rw
        restart: always
        image: aat-runner
        volumes:
          - aat-output:c:\aat-output\
    
    volumes:
      aat-output: