0

I have WSL + Docker + VS Code setup. The files I'm working on are in WSL filesystem and mounted to a Docker container.

To run the files in Docker container, it requires user www-data but I can't save the files and do git operation in my VS Code because they're in my WSL filesystem and it requires my WSL local user to save the files/run git operation.

So I have to sudo chown back and forth just to make sure I can run the files in Docker container and save the files/do git operation in my WSL filesystem.

Is there a way to make files work in WSL and Docker container without having to sudo chown back and forth?

maurisrx
  • 319
  • 4
  • 9

1 Answers1

0

I've found the solution by following this answer: https://stackoverflow.com/a/56904335/2927317.

We need to set the user and group ID for docker service to match user and group ID in the host by adding the definition user: USERID:GROUPID in docker compose file.

maurisrx
  • 319
  • 4
  • 9