Using Docker registry in Atomic Developer Bundle

With Atomic Developer Bundle you can easily setup OpenShift on your workstation and OpenShift creates a local docker registry which can be used independently.

To make these commands work, you need to have a working Vagrant setup with Virtualbox or Libvirt/KVM provider.

For this blog I am using ADB 2.1 . I also  believe these instructions will work for CDK 2.0.

$ vagrant plugin install vagrant-service-manager
$ git clone https://github.com/projectatomic/adb-atomic-developer-bundle
$ cd adb-atomic-developer-bundle/components/centos/centos-openshift-setup/
$ vagrant up

After the above commands you should get an OpenShift single node setup based OpenShift Origin. If you want to use a specific version of Origin  use the relevant tag from Docker hub in https://github.com/projectatomic/adb-atomic-developer-bundle/blob/master/components/centos/centos-openshift-setup/Vagrantfile#L9 and then do “vagrant up”.

There are various ways of using the OpenShift  from ADB/CDK i.e. web console or through oc binary/command line. I am going to login to the Vagrantbox and start using the docker registry.

$ vagrant ssh

Get the login credential

$ oc whoami -t
tF8vQU7xBaM4KA4iKgRmjWFlQex1oKJQr8nwAvblczE

Login to the docker registry

$ docker login -u admin -p tF8vQU7xBaM4KA4iKgRmjWFlQex1oKJQr8nwAvblczE -e abc@redhat.com hub.openshift.c
entos7-adb.10.1.2.2.xip.io
WARNING: login credentials saved in /home/vagrant/.docker/config.json
Login Succeeded

Pull an image from docker hub and push it to the local registry

$ docker pull fedora
Using default tag: latest
Trying to pull repository docker.io/library/fedora ... latest: Pulling from library/fedora
7891603e1bb1: Pull complete 
6932b0d5be7d: Pull complete 
Digest: sha256:cfd8f071bf8da7a466748f522406f7ae5908d002af1b1a1c0dcf893e183e5b32
Status: Downloaded newer image for docker.io/fedora:latest


Push the image to the local docker registry

$ docker push hub.openshift.centos7-adb.10.1.2.2.xip.io/sample-project/fedora:latest
The push refers to a repository [hub.openshift.centos7-adb.10.1.2.2.xip.io/sample-project/fedora] (len: 1)
6932b0d5be7d: Pushed 
7891603e1bb1: Pushed

Now you can pull the image from the local docker registry

$ docker pull hub.openshift.centos7-adb.10.1.2.2.xip.io/sample-project/fedora:latest
Trying to pull repository hub.openshift.centos7-adb.10.1.2.2.xip.io/sample-project/fedora ... latest: Pulling from sample-pro
ject/fedora
Digest: sha256:eb1987b9de75cd307f22ac8ed73cd20dcc39220904b8274eb2b92b55f383da30
Status: Downloaded newer image for hub.openshift.centos7-adb.10.1.2.2.xip.io/sample-project/fedora:latest

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s