How to Build Your Own Openshift OC Client

DZone 's Guide to

How to Build Your Own Openshift OC Client

The latest release of the boot2docker ISO might give you problems creating the base image. Fortunately, open technology is good about coming up with solutions.

· Cloud Zone ·
Free Resource

There was just a new release of the 

boot2docker ISO, a base image that is used to create the base container when you want to run the OpenShift Container Platform on your local machine as a developer does.

This is usually not an issue, but today it was.

When you try to use the OpenShift command line client, known as 'oc'

, you started to get errors. It does not matter if you are using Linux, Windows or osX, this will hit sooner or later if you client is version or earlier.

The Problem

It also seems to be affecting users of OpenShift Origin, Mini Shift, and OpenShift Container Platform clusters. For example, when installing OpenShift Container Platform I would run the following command:

$ oc cluster up --image=registry.access.redhat.com/openshift3/ose --version=v3.4.1.5 --create-machine'

The output you git is a full stop and the install is no longer possible:

-- Checking OpenShift client ... OK
-- Create Docker machine ...
Creating docker-machine openshift
-- Checking Docker client ... OK
-- Checking Docker version ... FAIL
Error: Minor number must not contain leading zeroes "03"

This leaves you up the creek without a paddle, as they say in the country.

Open Technology, Always a Solution

As you are using open technology, it is always possible to investigate and provide a fix, so I did just that. I raised an issue with the OpenShift community 

after discovering that the boot2docker image now includes the latest release of Docker. This uses version numbering 17.03.x, and there was an internal check that failed on comparing the minor version.

Cesar Wong stepped up and fixed this very quickly and showed us how to build our own new command line client with the fix.

I thought this would be nice to share with you so I put together build scenarios for each os and added a build script to my OpenShift Container Platform installation project on Red Hat Demo Central.

Here's how it works. 

You need to have an OpenShift installation somewhere, even a friend is good enough on another operating system than yours — does not matter. Once you have this, do the following:

  1.  Download and unzip the ocp-install-demo.
  2. Run the support/os-builder.sh with a single argument for your operating system type (linux, windows or osx), in this example we build for an osX binary:
$ ./support/os-builder.sh osx

This will ask you to login to your OpenShift, then kick off a new application to build the oc client. You can log in and watch the build under the project named my-project

Once it's done, you will see a deployment, so now you can go to  Applications -> Routes and see the route to your deployment web service that is hosting the newly built oc binary for you to download. Click on this link and it will open a new tab with the filesystem holding your oc client.

Now you have a fixed oc client v3.4.1.2 that will work just fine with your OpenShift cluster installations. Do note that OpenShift does not yet support running on docker v17.03 as it was just released today.

cloud, container images, docker, openshift, tutorial

Published at DZone with permission of Eric D. Schabell , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}