Chown is failing in docker container


I have a situation where I have a user who is a member of two different groups, call these uid and gid2. A file is created with ownership uid:uid and when I try to set the ownership of the file via chown uid:gid2 file it fails with EPERM.

I’ve put together a minimal demonstration of this in the following gist:

Any ideas why I may be running into this?