Server error pushing to OpenShift 3 internal registry

Solution Unverified - Updated

Environment

OpenShift Enterprise 3.0

Issue

  • I am unable to push an image to the OpenShift v3 internal registry.

  • Error pushing to registry:
    Server error: unexpected 400 response status trying to initiate upload of centos-http-docker-image

  • Error message in docker-registry pod logs:
    ... level=error msg="error authorizing context: repository namespace required" ...

Resolution

  • When Tagging your image you must include the project/namespace where this image is meant to land.
# docker tag <image>  <docker-registry-ip>:5000/<Project_Name>/<image> 

Example:

  # docker tag f60efc86ce26 172.30.40.26:5000/myproject/centos-http-docker-image 
  # docker push 172.30.40.26:5000/myproject/centos-http-docker-image 
  • Where "myprocect" is a namespace that the user your user that is logged into the docker registry has access to.

  • By default the project admin has this access. Add the user as admin for the project.

oc policy add-role-to-user admin <user> -n <Project_Name> 

Diagnostic Steps

  • If an image fails check your docker-registry pod logs for error messages:
# oc logs <registry-pod-name> 

  time="2015-09-14T12:13:50-04:00" level=error msg="error checking authorization: repository namespace required" http.request.host="172.30.40.26:5000" 
SBR
Components

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.