-
Notifications
You must be signed in to change notification settings - Fork 413
Description
Hi!
I've gone through the docs several times but couldn't find a proper example. I'm missing some examples of how to mount the bind type volume (or any type of volume) using the docker-compose.yml file instead Dockerfile. I've gone through these 2 pages already 1, 2, watched the videos and technically I've been able to mount the volume relatively easy. The issue I have is git stops to track my files in the dev container once only the relevant directory is mounted. I've tried to mount the .git folder from the parent folder but unfortunately it doesn't work as expected. Either it doesn't work at all or it marks all of the rest monorepo directories as deleted.
The reason why I'm asking is I'm encountering the issue of slow terminal. Unfortunately, the issue was automatically closed without any reasonable answer. I've found out the problem is caused truly by a large number of (mainly unnecessary) files from other repositories mounted into the workspace folder in the dev container. If I only load the relevant repository - the repository containing .devconatiner.json - the issue disappears and the terminal works smoothly. But git stops to track the files.
// file structure example
/monorepo
.git
.gitignore
/foo
/bar
This example loads all subdirectories of the mono repository into the workspace folder causing the terminal to be slow and sluggish
foo:
# some configuration
volumes:
- ..:/workspace:cached
So I changed it to which doesn't work at all
foo:
volumes:
- type: bind
source: ./
target: /workspace
The only solution I have come up so far is this one. At this point git stops tracking the files
foo:
volumes:
- type: bind
source: ./
target: /workspace/foo
which should be some kind of equivalent to I assume:
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace/foo, type=bind",
"workspaceFolder": "/workspace"
Thanks for your help in advance!