I’ve got a Ruby on Rails project that uses nodejs, and has a large
node_modules dir. I need to sync the whole project dir between my host and my docker container, but I don’t need this
node_modules folder synced back to my host, and I’d like to save some performance by not syncing it in my bind mount.
I read on this SO answer that by listing that subdir as a volume with no named volume or host side bind mount, docker would not try to sync it back to the host.
I also have a named volume to cache the
node_modules so I can blow away my containers without redownloading all my
Here’s an example of my app container’s volumes from
volumes: - ./:/opt/project - node_modules:/opt/project/client/node_modules # Exclude directories from bind mounts. Access inside container or `docker cp`. - /opt/project/client/node_modules/
However, because of https://github.com/docker/compose/pull/6406, this configuration now raises an error, because we have the same container dir mapped to two different mounts.
Is there a better way to do this I’m not aware of? Or am I requesting a feature here?
OS: MacOS 10.13.6, though the coworker experiencing the issue is on Linux, who has the 1.24.0 docker-compose release. Docker for Mac still uses docker-compose 1.23.2.
App Version: Docker-compose 1.24.0