Launching a docker image in Openshift Origin

I am very new to Openshift Origin. Now I'm trying to deploy docker containers in OpenShift. To do this, I created a very simple docker container that adds two numbers and gives the result:

https://github.com/abrahamjaison01/openshifttest

I created a docker image locally and a public docker image in a docker hub:

docker pull abrahamjaison/openshifttest 

I run the docker image locally as follows:

  [ root@mymachine /]# docker run -it --rm abrahamjaison/openshifttest Enter first large number 12345 Enter second large number 54321 Result of addition = 66666 

Since I'm completely new to Openshift, I have no idea how to deploy this in an Openshift environment.

I created a new project: oc new-project openshifttest

Then a new application: oc new-app docker.io/abrahamjaison/openshifttest

But then I do not know how I can access the console / terminal for data entry. Also many times when I run this, I get the output as a “failed deployment” when I issue the command “oc status”.

Basically, I would like to know how I can deploy this docker image in openshift and how I can access the terminal to provide inputs for the addition.
Can anyone help me with this?

+6
source share
2 answers

OpenShift is primarily intended for long-term services such as web application and database. It is not intended to run a Docker container to wrap a command that then returns the result to the console and exits.

To better understand how OpenShift 3 is used, download and read the free e-book at:

The closest you can do the same thing as docker run is the oc run command, but it seems to hit the whole point of OpenShift. You are better off using Docker on your own system for what you are describing.

Guess the command you would use if you really wanted to try:

 oc run test -i --tty --rm --image=abrahamjaison/openshifttest 

As I said, it’s not really intended for this. That oc run exists is more suitable for testing against deployment problems for your applications.

+3
source

Following the fragment Creating an application from an image , the syntax should be:

 oc new-app abrahamjaison/openshifttest 

By default, OpenShift will search for an image in DockerHub .
But this assumes that you transferred your GitHub image in the first place: see " Store Images on the Docker Hub ". This may be the missing step in your process.

Interaction with oc is performed using the OpenShift CLI or the web console, as shown on the authentication page.

+2
source

Source: https://habr.com/ru/post/1011707/


All Articles