Skip to main content

Permission denied pushing to OpenShift Registry

·1 min

Recently, I ran into an 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: serviceaccount@example.org
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 articles suggested verifying the file ownership of the files and directories in the volume and comparing 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/