Lab 6 - Deploying existing Images from Docker Hub
Deploying existing images to OpenShift: video (7:09 mins)
Overview
This is a quick lab that demonstrates how to deploy a public image from Docker Hub onto OpenShift. As starting point an image of the ‘authors’ microservice from this workshop has already been loaded on Docker Hub.
Note: Not all images from Docker Hub can be used on OpenShift. For example, OpenShift does not run containers as ‘root’ which means that a lot of images from Docker Hub won’t start. See the OpenShift documentation for details.
Step 1
Open the OpenShift Console from the IBM Cloud OpenShift dashboard.
Step 2
Select your own project ‘yourfirstname-yourlastname’.
Step 3
Click ‘Add to Project’, followed by ‘Deploy Image’ in the pop up menu.
Step 4
Select ‘Image Name’, enter ‘nheidloff/authors:v1’ as the image name, then click the search icon.
Step 5
In the ‘Deploy Image’ dialog, scroll down and change the ‘Name’ from ‘authors’ to ‘authors-img’. This will also change the ‘app’ label. Then click on ‘Deploy’.
Navigate back to the overview page.
Step 6
Open ‘authors-img’ and click ‘Create Route’.
Step 7
Accept the defaults, scroll down and click the ‘Create’ button (not shown in the screenshot).
Step 8
Click on the URL of ‘authors-img’, this will open the default Open Liberty Welcome page, and append ‘/openapi/ui’ to the URL.
Step 9
This opens the Open API user interface to try the REST API.
Optional: Use your own Image
If you want you can make changes to the Java code and/or image and push these changes to your own Docker Hub account. In order to do this, you need a Docker Hub account and invoke these commands:
$ cd ${ROOT_FOLDER}/deploying-to-openshift
$ DOCKER_ACCOUNT=<your-docker-account>
$ docker login
$ docker build -t $DOCKER_ACCOUNT/authors:v1 .
$ docker push $DOCKER_ACCOUNT/authors:v1
Continue with Lab 7 - Deployments of Code in GitHub Repos