Home > Enterprise >  Mounting volume to specific windows path in docker-compose
Mounting volume to specific windows path in docker-compose

Time:08-18

I want to mount a volume to a specific Windows folder. I have two folders in the Desktop: Input and Output

Inside my docker container I have a script that scans an input folder (located in '/code/input'), processed the file and moves it to an output folder (located in '/code/output')

Then from the windows machine, I want to be able to throw files in Desktop/Input and see them move to Desktop/Output

This is my docker-compose file:

version: "3.8"

services:
  parser:
    build: .
    volumes:
      - //C/Users/alonso/Desktop/Input:/code/input
      - //C/Users/alonso/Desktop/Output:/code/output
volumes:
  //C/Users/alonso/Desktop/Input: {}
  //C/Users/alonso/Desktop/Output: {}

However docker doesn't like this syntax in the docker-compose file

volumes Additional property //C/Users/alonso/Desktop/Input is not allowed

How can I create this volume that points to an specific windows path?

CodePudding user response:

Try this:

version: '3.8'

services:
  parser:
    build: .
    volumes:
      - "C:/Users/alonso/Desktop/Input:/code/input"
      - "C:/Users/alonso/Desktop/Output:/code/output"
  • Related