This optional variable can be used to define another location - like a subdirectory - for the database files. The default is /var/lib/postgresql/data. If the data volume you’re using is a filesystem mountpoint (like with GCE persistent disks) or remote folder that cannot be chowned to the postgres user (like some NFS mounts), Postgres initdb recommends a subdirectory be created to contain the data.
So if you bind mount a folder instead of using a local volume, you can try to set PGDATA to use a subfolder of “data”. Example in the linked description. Usually setting proper permissions and groups on the source folder is enough, but sometimes services inside the container try to change permissions unconditionally. I don’t remember if Postgres is one of those services.