In the second part of the docker series I will try and deploy the image I created in the Oracle Cloud using Oracle Container Cloud Service. First register for a trail account here. After you completed all the steps, be aware that it might take some while for you can actually start. You will receive an email when you are ready to go. Let’s start here!
Login into the Oracle Cloud.
Click on Create Instance and click Container Classic.
Then go to the console. From here click Create Service.
Fill in the fields and click on Edit near the SSH key. Select Create new Key and after that, you can download it.
Check all the data and click Create to confirm.
Now the service is created for you. You will have an overview like this:
You might have to wait a bit longer to continue with the walk through as it is being provisioned. You can tell by the little hourglass in the service details. You might have to wait like 10 minutes or so for it to finish. You will also receive an email when it is done.
When it is provisioned…click your service and go to the container console
Use the username and password to login which you entered in the previous steps.
The next screen will be the Container Cloud Service Dashboard.
Now the thing we want to do is deploy the docker image which is on my DockerHub so first we have to configure this. Let’s go to Registries.
Click Edit and fill in here all your DockerHub info. You can test the connection by clicking Validate.
The next step is to create a service. Go to Services and click New Service. Now fill in the Service name and Description. Also the name of the image and the possible version. Don’t forget to click the port check box on the right to expose the ports of the image.
I used port 8080 as you can see here. When done, click Save. Now you can search by name in the top right and when you have found your service you can click Deploy.
Just accept the default settings and click Deploy again. You then get a screen which shows you that everything is starting. Mine gave an error though! You can click Details to see what went wrong.
It seems it can’t find my docker image. When we go back to the service definition and click edit, I saw I forgot my username in front of the image and I didn’t include the tag so I changed climbersapi-docker to hugohendriks/climbersapi-docker:1.0.0.
Lets try that again. Remove the deployment and deploy the Service again. Now I see that it can download the image and everything goes green. So far so good.
We actually want to see if the SpringBoot API is up and running. We first need to get the public ip on which we can connect to the application. You can see that by going to hosts and clicking on your container. You can then see the details and on the right side the public ip.
and for the final test, lets use Postman to make a call to the API.
If we want to be very high available, we might want have 2 services and have them load balanced. You can easily deploy the image again if you would have had more hosts in your pool. With a trail account we unfortunately only have 1.
I have to be fair. I was surprised how easy it was to deploy a Docker Image from DockerHub on the new Oracle Container Cloud Service. In the next blog I will try and to the same only then using the Amazon EC2 stack.
- Part 1: Running a simple SpringBoot API as a docker container