Laravel permissions issue - I need to keep using chown

This is my setup: PHP-FPM container with symlink volume (configured in the docker-compose.yml file) to a folder in Ubuntu 20.04 on WSL2.

My problem is this: I can’t save Laravel project files from inside VSCode because I get Permission Denied, so every time (yes, every time) I rebuild the container, I have to use sudo chown -R myuser ~/mysite (myuserrefers to my Ubuntu user and ~/mysite is the path to the folder with the code that’s linked to the container) . But that’s not all - when I want to access my site from the browser, I get a Laravel error: The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied

So what I do is I go inside the container CLI and type chown -R www-data:www-data /var/www/ , (found the solution here: Laravel & Docker: The stream or file “/var/www/html/storage/logs/laravel.log” could not be opened: failed to open stream: Permission denied)

But, whenever I type chown inside the container, it removes the ownership from my user on the Ubuntu machine where I save the project files. (I thought they are isolated?).

So I end up typing chown on the container and on the Ubuntu host in turns

How can I fix that? With regards to security as well (Not just giving permissions to everyone)

Duplicate of Laravel and Docker permission issue - can't save files.