Q:

Write Permissions in Docker Volume

I created a docker volume with:
docker volume create my-volume-name

In my console app running in the docker container, I use a creation config like this:
{
  "HostConfig": {
    "Binds": [
      "my-volume-name:/app/my-volume-name:rw"
    ],
    "Privileged": true
  }
}

The container sees the volume, but doesn't have any permissions to write to it.
  It gives me a permission denied error.   (exception below is me trying to create a file in the volume).
        //create a file
        try{
        string path = Path.Combine(Directory.GetCurrentDirectory(), "my-volume-name","example.txt");
        Console.WriteLine($"PATH {path}");
        if (!File.Exists(path)){
            File.Create(path);
            TextWriter tw = new StreamWriter(path);
            tw.WriteLine($"{DateTime.Now.ToString()}The very first line!");
            tw.Close();
        }else if (File.Exists(path)){
            using(var tw = new StreamWriter(path, true)){tw.WriteLine($"{DateTime.Now.ToString()}The next line!");}
        }
        }catch(Exception e){Console.WriteLine($"ERROR:{e.ToString()}");}

This is what I get:
 Access to the path '/app/my-volume-name/example.txt' is denied. ---> System.IO.IOException: Permission denied

What am I missing to be able to write to the volume I created with the docker volume create command?    The goal here is to have a shared volume at the host that certain containers I've created can read and write into it.
edit (the dockerfile appended):
FROM microsoft/dotnet:2.0-runtime-stretch AS base

RUN apt-get update && \
    apt-get install -y --no-install-recommends unzip procps && \
    rm -rf /var/lib/apt/lists/*

RUN useradd -ms /bin/bash moduleuser
USER moduleuser

RUN curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg

FROM microsoft/dotnet:2.0-sdk AS build-env
WORKDIR /app

COPY *.csproj ./
RUN dotnet restore

COPY . ./
RUN dotnet publish -c Debug -o out

FROM base
WORKDIR /app
COPY --from=build-env /app/out ./

#moving down because CI/CD builds in VSTS didnt like two copies next to each other.

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

When I ls -l in the container, I see this:
drwxr-xr-x 3 root root    4096 Jul  2 13:28 my-volume-name

edit 2: 
When I remove the creation of moduleuser in the dockerfile, I get this error:
ERROR:System.IO.IOException: The process cannot access the file '/app/my-volume-name/example.txt' because it is being used by another process.   

But it was created - so it looks like I'm on the right path.

A:

docker volume create my-volume-name will create space with root privileges. Please check in container with which user, your app is running. Either update the ownership of volume or run application with root user. if need further help, please provide dockerfile used for application.

