Example tested with UID
The thing is you should export UID variable and then it works
export UID=${UID}
Put in docker-compose file user: "${UID}"
user: "${UID}"
docker compose up
...
profit