Container app can't write to mounted folder

On my local machine windows my app works ok.
But when running my docker container on linux (aws amazon linux 2023) the app inside can’t write to the mounted folders.
It gets permission denied error.

And the only solution I have for now is before calling docker-compose up, to give rw permissions to that folder to all:
sudo chmod -R a+rw /App_Data

my compose.yaml:

services:                  
  webapp1:
    build: 
      target: final      
    volumes:
      - ./volumes/App_Data/:/app/App_Data   

and Dockerfile:

# syntax=docker/dockerfile:1

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build

COPY . /source

WORKDIR /source/WebUI

ARG TARGETARCH

RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \
    dotnet publish -a ${TARGETARCH/amd64/x64} --use-current-runtime --self-contained false -o /app

FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS final
WORKDIR /app

COPY --from=build /app .

USER $APP_UID

ENTRYPOINT ["dotnet", "WebUI.dll"]

Yes, that’s the way. Or you can use a volume with a custom source path to make it automatic.

See Avoid accidental data loss on volumes

Read the rest of the blogpost as well if you want to understand why it is necessary