

If you delete the node_modules folder in the container, it may lose the connection to the volume. Otherwise run Remote-Containers: Open Folder in Container. If you've already built the container and connected to it, run Remote-Containers: Rebuild Container from the Command Palette ( F1) to pick up the change.

This second step is not required if you will be running in the container as root. "mounts" :, "postCreateCommand" : "sudo chown node node_modules" Then use the mounts property (VS Code 1.41+) to mount the node_modules sub-folder into a named local volume instead. Use the workspaceMount property in devcontainer.json to tell VS Code where to bind your source code.
#Docker desktop volume location how to
Let's use the vscode-remote-try-node repository to illustrate how to speed up yarn install. Follow the appropriate steps below based on what you reference in devcontainer.json. This makes it ideal for storing package folders like node_modules, data folders, or output folders like build where write performance is critical. Fortunately, Docker has the concept of a local "named volume" that can act like the container's filesystem but survives container rebuilds. Since macOS and Windows run containers in a VM, "bind" mounts are not as fast as using the container's filesystem directly. The next two sections will outline how to use a named volume in other scenarios. See Open a Git repository or GitHub PR in an isolated container volume for details on using this approach. In addition to not polluting your file tree, local volumes have the added benefit of improved performance on Windows and macOS. command uses an isolated, local Docker named volume instead of binding to the local filesystem. The Remote-Containers: Clone Repository in Container Volume.

Video: Speed up Remote-Containers on Windows Use Clone Repository in Container Volume See Open a WSL 2 folder in a container on Windows for details on using this new engine from VS Code. Therefore, if you store your source code in the WSL 2 filesystem, you will see improved performance along with better compatibility for things like setting permissions. Docker Desktop 2.3+ includes a new WSL 2 Engine that runs Docker in WSL rather than in a VM. Windand up includes an improved version of the Windows Subsystem for Linux (WSL 2) that provides a full Linux kernel and has significantly improved performance over WSL 1. Store your source code in the WSL 2 filesystem on Windows There are few things you can do to resolve these type of issues.
#Docker desktop volume location install
While this is the simplest option, on macOS and Windows, you may encounter slower disk performance when running commands like yarn install from inside the container. The Remote - Containers extension uses "bind mounts" to source code in your local filesystem by default.
