These steps presume you already have Docker installed. If you don’t, look at this quickstart docker guide, or install Docker from here. Before you proceed any further confirm you can run docker process commands by trying
Download the Linux oc binary and place it in your path.
Bring up your cluster for the first time by running:
oc cluster up --public-hostname=127.0.0.1 --host-data-dir=$HOME/os/data-dir --host-config-dir=$HOME/os/config-dir
If successful you should see output like the following:
To bring up your cluster subsequently pass in the
--use-existing-config flag to your
oc cluster up command:
oc cluster up --public-hostname=127.0.0.1 --host-data-dir=$HOME/os/data-dir --host-config-dir=$HOME/os/config-dir --use-existing-config
If you encounter any errors the error messages are generally helpful enough to diagnose and resolve the issue. Before delving too deeply, be sure to double-check your version of Docker, and that it is compatible with the version of OpenShift you are using.
Some issues that were encountered included:
Once you have successfully brought your cluster up you should be able to access the OpenShift console through the url specified at the end of your
oc cluster up log.
Deploy your app by executing:
oc new-app <dockerhub-username>/<dockerhub-image-name>
If you don’t have an app, you can use the nodejs-hello example from google to test a deployment:
oc new-app google/nodejs-hello
In the OpenShift console you should see your app spinning up in its pod.
To access your app, you will need to create an external-facing route to it. Do this through the cli with:
oc expose service/<name> --hostname=<www.example.com>
Or if you are using the nodejs-hello example from google:
oc expose service/nodejs-hello --hostname=nodejs-hello.127.0.0.1.nip.io:8080
You can also set up a route through the openshift console:
Congratulations! You have now deployed your app on OpenShift and should be able to access your deployed app through the route you specified.
To bring down your cluster
oc cluster down will take down your cluster.
Through the above steps you should have:
As seen above, Containerised apps can be deployed quite easily to an OpenShift cluster. Docker Hub can facilitate this process by providing a place to host your container images, and you may wish to create an account there (some steps to do so can be found here).
OpenShift also supports building and deploying your directly from source code, which may be covered in a subsequent document.
For further reading, check out the below links & also feel free to reach out to feedhenry-dev at redhat.com or the #feedhenry IRC channel if you need help.