Sometimes you need to push images into the OpenShift registry locally for testing, the steps involved are below. Note that I start/stop local Openshift development with a command which includes:

BASE_DIR="/openshift/project"
export OPENSHIFT=$(ip addr show docker0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)
oc cluster up --base-dir=${BASE_DIR} --public-hostname=${OPENSHIFT}

Which means it consistently listens on 172.17.0.1 which is available from within and outside of the OpenShift cluster, which 127.0.0.1 isn't.

Ensure the that ip you will use for the docker registry is in the /etc/docker/daemon.json as an insecure registry somewhat like this:

{
  "insecure-registries": [
    "172.30.0.0/16",
    "172.17.0.1/32"
  ],
  "default-address-pools":
  [
    {
        "base": "172.17.0.0/16",
        "size": 24
    }
  ]
}

Then make the config active:

systemctl daemon-reload
systemctl restart docker

Login as admin to OpenShift and expose the internal registry:

oc login -u system:admin
oc expose svc docker-registry -n default
oc get route -n default  | grep registry

That should now show the registry as available, and then its possible to log back in as a developer, then generate a token to login to the registry:

oc login -u developer
docker login docker-registry-default.172.17.0.1.nip.io -p $(oc whoami -t) -u developer

Away you go building etc directly into the OpenShfit docker registry.

Note: If you are doing this to test a new s2i image, for example, that the OpenShift build process doesn't appear to be able to use anything created this way as the builder image needs to be pulled from a non-authenticated docker registry.

To get around this, I ended up pushing the s2i image up to docker hub under a different account and then changing the build config to point to that account.