Reputation: 317
I have a nice project with a .devcontainer config. Since the vscode update to 1.63 I have some trouble with the docker setup. Now I'm using the newest 1.64.0
I just want to build a new container with a clean volume an start in a fresh environment.
What happens is, that a new container is starting and I see some stuff from another container. Same if I clone a git repo into a container volume.
In the devcontainer.json I set:
"workspaceFolder": "/workspace",
"workspaceMount": "source=remote-workspace,target=/workspace,type=volume",
Upvotes: 2
Views: 433
Reputation: 3095
To build a new devcontainer in a fresh environment you can install devcotainer cli and trigger build manually.
I'm used to mount workspace as bind mount (on windows with wsl2 files) insted of volume mount, i think that the main issue is the volume name: if both project has "source=remote-workspace" the volume will be detected as the same.
With nodejs where I want to keep node_modules
folder inside container, I have done a double mount following this official vscode guide for this usecase.
So I have left workspaceMount as a default bindmount than I have added a volue that override a specific folder.
{
"mounts": [
// vvvvvvvvvvv name must be unique
"source=projectname-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume"
]
}
The results is:
/
is server by container${containerWorkspaceFolder}
is served by bind mount${containerWorkspaceFolder}/node_modules
is server by named volumesUpvotes: 1