Red Hat OpenShift Container Platform Cheat Sheet

Red Hat OpenShift Container Platform Cheat Sheet

Let's list out our current available projects (those that we have at least view access for):

$ oc get projects

 

If this is our rst login and no one has added us to any existing projects, there shouldn't be any projects listed. Let's create a project (allowed by self-provisioner role to all authenticated users, in the default Openshift policy installation).

$ oc new-project myproject --display-name='My Project' --description='cool project owned by myuser'

 

Now using project "myproject" on server "https://openshift.example.com:443". To build a new example applicatin on Ruby you can add applications to this project with the 'new-app' command. For example, try:

oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git
See a step-by-step example to build, deploy and manage an application with OpenShift and look at administrator tasks that can impact developers.

Containers Cheat Sheet

Containers Cheat Sheet Image
  1. docker CLI
    1. Container Related Commands
      docker [CMD] [OPTS] [CONTAINER]

      Examples
      All examples shown work in Red Hat Enterprise Linux
       
      1. Run a container in interactive mode:
        #Run a bash shell inside an image
        $ docker run -it rhel7/rhel bash
        #Check the release inside a container
        [root@.../]# cat /etc/redhat-release

         
      2. Run a container in detached mode:
        $ docker run --name mywild y -d -p 8080:8080 jboss/wild y
         
      3. Run a detached container in a previously created container network:
         $ docker network create mynetwork
        $ docker run --name mywild y-net -d --net mynetwork
         -p 8080:8080 jboss/wild y

         
      4. Run a detached container mounting a local folder inside the container:
         $ docker run --name mywild y-volume -d
        -v myfolder/:/opt/jboss/wild y/standalone/deployments/
        -p 8080:8080 jboss/wild yjboss/wild y

         
      5. Follow the logs of a specific container:
         $ docker logs -f mywild y
        $ docker logs -f [container-name|container-id]
Get started with an introduction to container architecture including engine, image, registry, volume, related commands.