1

I have a multi-container setup that I start with a docker-compose file. Everything works fine until I replace my setup to any folder in my C drive.

For example; When i call 'docker-compose up' here it works fine: C:\Users\me\Desktop\PrototypeEnvironment\Software\DataSearch

And it doesn't work here: C:\test

node_1     | module.js:327
node_1     |     throw err;
node_1     |     ^
node_1     |
node_1     | Error: Cannot find module '/home/app/chat/server.js'
node_1     |     at Function.Module._resolveFilename (module.js:325:15)
node_1     |     at Function.Module._load (module.js:276:25)
node_1     |     at Function.Module.runMain (module.js:441:10)
node_1     |     at startup (node.js:134:18)
node_1     |     at node.js:962:3
trunk_node_1 exited with code 1

I'm using the Docker toolbox for windows Does anyone have any idea why this happens. If you need more information please ask. Thanks in advance.

Docker-compose file:

    version: '2' 
    services:
      node:
        build: ./node_js
        command: node_modules/.bin/nodemon -L index.js
        command: node server.js
        depends_on:
          - mongo
        links:
          - mongo      
        environment:
          NODE_ENV: development  
        ports:
          - '8080:8080'
          - '3000:3000'
        volumes:
          - ./node_js:/home/app/chat
          - /home/app/chat/node_modules

      mongo:
        build: ./mongo
        ports:
          - "27017:27017"
        volumes:
          - ./mongo:/root
      nodered:
        image: jankappe/nodered
        ports:   
          - '1880:1880'
Jan
  • 560
  • 6
  • 19
  • Show your docker-compose.yml please. Are you using volumes? – Robert May 29 '17 at 13:40
  • @Robert see my updated question – Jan May 29 '17 at 13:48
  • This part is tricky, the volume `/home/app/chat/node_modules`. Remove it and try again. If it works, check my answer [here](https://stackoverflow.com/questions/38425996/docker-compose-volume-on-node-modules-but-is-empty/43728476#43728476) – Robert May 29 '17 at 13:54
  • @Robert this change has the same result – Jan May 29 '17 at 13:57

1 Answers1

1

Docker has a problem when you are not using C:\Users\{your_user} folder for you project location, because other folders (not from C:\Users\{your_user} folder) are some kind out of the scope of Docker. For example if I put my project in C:\my_porject then volumes from docker-compose.yml are not working. And when I put the same project somewhere inside C:\Users\{my_user}\my_porject folder (or any subfolder of user root folder) then volumes are working.

arbogastes
  • 1,308
  • 9
  • 10
  • Thanks for the explanation! Is there any way to fix this, or is this just the way it is – Jan May 29 '17 at 14:00
  • The problem is because VirtualBox VM that is giving Linux host for Docker is sharing C:\Users. Well probably you can try to do something with this, but you must do few additional steps - look for "docker windows users folder" in web ;) – arbogastes May 29 '17 at 14:15