Basically, Openshift provides a range of ids that can be used, the actual UID that is assigned is done during deployment time. Solution is to make root group the owner of relevant files and to give those files rw access for the group. Then add the user dynamically to /etc/passwd.
See comment on this issue documented in Solr Github.
This suggestion is relevant to our case because solr also uses alpine. Our docker image is based on alpine. Some other solutions suggested on the internet may not be relevant, for example using nss_wrapper because this package is not available on alpine.
Note: Another workaround is to give permissions to run image as root. However, Openshift admins may not allow this at some customer sites. For example,
oadm policy add-scc-to-user anyuid -z default
https://docs.openshift.com/enterprise/3.2/creating_images/guidelines.html "Support Arbitrary User IDs".