0

I try to learn about Open Shift, how it works, how to run apps, build images etc.

To start with something, which I thought will be rather simple, I decided to run a pod with pure centos7 OS, based on this image. I installed locally minishift v1.11.0+4459917, I created a new project, and performed command: oc new-app openshift/base-centos7 in this project. As a result I received the following message:

--> Found Docker image bb81a09 (11 months old) from Docker Hub for "openshift/base-centos7"

    * An image stream will be created as "pon3:latest" that will track this image
    * This image will be deployed in deployment config "pon3"
    * The image does not expose any ports - if you want to load balance or send traffic to this component
      you will need to create a service with 'expose dc/pon3 --port=[port]' later
    * WARNING: Image "openshift/base-centos7" runs as the 'root' user which may not be permitted by your cluster administrator

--> Creating resources ...
    imagestream "pon3" created
    deploymentconfig "pon3" created
--> Success
    Run 'oc status' to view your app.

As I can see in the warning this image runs as root, which is clearly not a good practice, but it may be worked around, as described here and here. I tried both approaches - I have created a new service account with anyuid scc, and I assigned anyuid scc to default sa. Unfortunately I'm still not able to run a pod based on this image. The result looks like this:

oc get pods

mycentos-1-deploy         1/1       Running            0          32s
mycentos-1-p1vh5          0/1       CrashLoopBackOff   1          30s

I try to troubleshoot this way:

oc logs -p mycentos-1-p1vh5

This image serves as the base image for all OpenShift v3 S2I builder images.
It provides all essential libraries and development tools needed to
successfully build and run an application.

To use this image as a base image, you need to have 's2i/bin' directory in the
same directory as your S2I image Dockerfile. This directory should contain S2I
scripts.

This base image also provides the default user you should use to run your
application. Your Dockerfile should include this instruction after you finish
installing software:

USER default

The default directory for installing your application sources is
'/opt/app-root/src' and the WORKDIR and HOME for the 'default' user is set
to this directory as well. In your S2I scripts, you don't have to use absolute
path, but rather rely on the relative path.

To learn more about S2I visit: https://github.com/openshift/source-to-image

Additionally I tried to troubleshoot with oc adm diagnostics but to be honest I didn't see anything relevant to this issue.

I'm clearly missing something here. Can someone give me a hint how this should be handled or how can I try to troubleshoot this? Is there a different way to run pure centos OS?

Thank you for any help.

kasia
  • 1
  • 2

1 Answers1

1

You need the image you want to deploy using oc new-app to have an actual application in it. The openshift/base-centos7 image is a base image only on which other images are built and doesn't have an application in it.

If you just want to spin up a container and be presented with a shell environment in which you can play in use the oc run command instead.

OpenShift isn't like a traditional VPS where you just spin up permanent shell environments which you then access to set up your application manually. The idea is that you build your application into an image and deploy the application.

I would suggest you go read:

and work through the exercises at:

to learn more about what OpenShift is and how to use it.

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134
  • Hi Graham, thank you very much for all information and sources - I will definitely take a look at this. I tried to run the following command: `oc run centos7 --image=openshift/base-centos7 ` but unfortunately it failed as well. The result is as follow: `centos7-1-67ttw 0/1 CrashLoopBackOff 3 2m centos7-1-deploy 1/1 Running 0 2m` Additionally, when I run `oc describe pod centos7-1-67ttw` to see some logs I can see an event `Error syncing pod`. Do you see what I'm doing wrong here? Thank you for your help. – kasia Jan 23 '18 at 17:10
  • Research the command properly. You need to provide options to have it give you the interactive shell. See the ``--tty``, ``--stdin`` and ``--restart=Never`` options. Look at those and then provide the full command you are running and can debug. – Graham Dumpleton Jan 24 '18 at 00:24