Search code examples
dockeropenshiftdocker-registryopenshift-origin

Unable to push docker image to Openshift Origin Docker registry


I was trying to deploy a docker image I have created via Openshift. I followed the instructions in: http://www.opensourcerers.org/importing-an-external-docker-image-into-red-hat-openshift-v3/

However, as I tried to push my docker image to the Openshift registry, it did not succeed, as shown below

[root@mymachine ~]# docker push 172.30.155.111:5000/default/mycostumedaemon

The push refers to a repository [172.30.155.111:5000/default/mycostumedaemon]

0a4a35d557a6: Preparing

025eba1692ec: Preparing

5332a889b228: Preparing

e7b287e8074b: Waiting

149636c85012: Waiting

f96222d75c55: Waiting

no basic auth credentials

Following are the docker version and openshift versions:

[root@mymachine ~]# docker --version

Docker version 1.11.0, build 4dc5990

[root@mymachine ~]# oc version

oc v1.2.0

kubernetes v1.2.0-36-g4a3f9c5

Could someone help me out with this? Not sure what it means by "no basic auth credentials" since the openshift user and server user are root users with all privileges.


Solution

  • After performing oc login to authenticate on your cluster you have to go inside your default project

    $ oc project default
    

    Check the service ip of your registry:

    $ oc get svc
    
    NAME              CLUSTER-IP       EXTERNAL-IP   PORT(S)                   AGE
    docker-registry   172.30.xx.220   <none>        5000/TCP                  76d
    kubernetes        172.30.0.1       <none>        443/TCP,53/UDP,53/TCP     76d
    router            172.30.xx.xx     <none>        80/TCP,443/TCP,1936/TCP   76d
    

    Check your token:

    $ oc whoami -t
    trSZhNVi8F_N3Pxxx
    

    Now you can authenticate on your registry:

    docker login -u test -e [email protected] -p trSZhNVi8F_N3Pxxx 172.30.xx.220:5000
    WARNING: login credentials saved in /root/.docker/config.json
    Login Succeeded