dockerfile - Add a volume to Docker, but exclude a sub-folder -


supposed have docker container , folder on host /hostfolder. if want add folder docker container volume, can either using add in dockerfile or mounting volume.

so far, good.

now /hostfolder contains sub-folder, /hostfolder/subfolder.

i want mount /hostfolder docker container (whether read-write or read-only not matter, works both me), not want have included /hostfolder/subfolder. want exclude this, , want docker container able make changes sub-folder, without consequence of having changed on host well.

is possible? if so, how?

if want have subdirectories ignored docker-compose persistent, can following in docker-compose.yml:

volumes:   node_modules: services:   server:     volumes:       - .:/app       - node_modules:/app/node_modules 

this mount current directory shared volume, mount persistent docker volume in place of local node_modules directory. similar answer @kernix, allow node_modules persist between docker-compose up runs, desired behavior.


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

java - Could not locate OpenAL library -

Non Unique Username with ASP.Net Identity 2.0 -