1

I'm using windows 10 and i have a folder with multiple reactjs apps(app1, app2 etc.)

I want to mount this entire folder inside a container but exclude all the "node_modules" directories, so it wont be mapped between container and host.

Can I achieve that with docker-compose volumes?

Now my docker-compose.yaml file looks like this:

version: '3.8'

services:
    web:
        container_name: app_container
        volumes:
        - ".:/apps"
        - "/apps/app1/node_modules"

But this ignores only the node_modules from the "app1".

Tom
  • 4,070
  • 4
  • 22
  • 50
nipuro
  • 310
  • 5
  • 22
  • Did you try adding a dot in front, i.e. `- ./apps/app1/modules`? – Marko E Aug 14 '20 at 15:20
  • this is just for node_modules inside "app1". i want for all the node_modules directories from all the apps – nipuro Aug 14 '20 at 15:41
  • Try adding a trailing slash also, `/apps/app1/modules/` and see if that works. – Marko E Aug 14 '20 at 20:16
  • I think my question wasn't clear enough. I want to exclude all the node_modules directories from all the apps in the container with just one line in the volume configuration for the docker-compose file. Something like this: - /apps/*/node_modules – nipuro Aug 15 '20 at 05:34
  • I guess you can maybe find your answer here: https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder. – Marko E Aug 15 '20 at 07:48

0 Answers0