# Exercise 1: Deploy a Java application with a Docker Image

In this exercise, you'll deploy a simple Java microservice - "Authors" from a public image registry to OpenShift. You can find the image on Docker Hub here: <https://hub.docker.com/r/nheidloff/authors>

## Deploy Authors application

Access your cluster on the [IBM Cloud clusters dashboard](https://cloud.ibm.com/kubernetes/clusters). Click the `OpenShift web console` button on the top-right. (This is a pop-up so you'll need to white list this site.)

Create a project, you can title it whatever you like, we suggest "example-authors."

![Create Project](/files/-Lo1N4RmJ8_ZuDPQ_XKO)

Click on your new project. You should see a view that looks like the image below. Click on the *Deploy Image* button on the main screen, or click on the *Add to Project* button and choose *Deploy Image* from there.

![Click 'Deploy Image'](/files/-M0KOKdlLGbp4aYOd1PM)

At the pop up, choose the *Image Name* option. Enter `nheidloff/authors:v1` as the image name and click the search icon. Once the image metadata loads click the *Deploy* button.

![Add image name](/files/-M0KOKdnYz62pRgOJ-ks)

At the application overview page, click the *Create Route* option. This will give our application an external URL.

![Create a route](/files/-M0KOKdrkwqT8rR9ifcD)

The default options are sufficient, scroll down to the bottom and click the *Create* button.

![Click Create](/files/-M0KOKdtOeMQl-tYE6kr)

Try to launch the application by copying the route's URL and appending `/openapi/ui`.

![Copy the URL](/files/-M0KOKdvOss0rV06TpeV)

{% hint style="info" %}
Add `/openapi/ui` to the URL!
{% endhint %}

The Open API user interface for our *Authors* service will load. We can test the application by clicking the **GET /v1/getauthor** API. Choose the *Try it out* button and entering "Niklas Heidloff" as the query.

![Open the Open API UI](/files/-M0KOKdxjeBncR7fHpVF)

**Congratulations!** You just deployed an image from a public registry aviable from Docker Hub.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ibm-developer.gitbook.io/openshift101/alternates/exercise-01b.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
