Permission denied pushing to OpenShift Registry

Permission denied on pushing build images into OpenShift internal registry

Recently, i ran into a issue where pushing images to the docker registry after a build fails

Pushing image docker-registry.default.svc:5000/simple-go-build/simple-go:latest ...
Registry server Address:
Registry server User Name: serviceaccount
Registry server Email:
Registry server Password: <<non-empty>>
error: build error: Failed to push image: received unexpected HTTP status: 500 Internal Server Error

Registry pods logs show permission denied

err.code=UNKNOWN err.detail="filesystem: mkdir /registry/docker/registry/v2/repositories/simple-go-build/simple-go/_uploads/c34415b4-c6d8-42ba-9854-aee449efd984: permission denied"

One of the Red Hat solutions article suggested to verify the file ownership of the files, directories in the volume and compare it to the uid of the registry

Changing the owner recursively to the uid of the registry, fixed the issue

root@master# chown -R 1001 /exports/registry/docker/
Built with Hugo
Theme Stack designed by Jimmy