Skip to content

Latest commit

 

History

History
69 lines (45 loc) · 3.06 KB

PyLab1.md

File metadata and controls

69 lines (45 loc) · 3.06 KB

Deploy an Python App using image in a external registry (ie Dockerhub)

Build and Push Docker Image to External Registry

docker login

Navigate to project folder with Docker file and run the following commands:

docker build -f Dockerfile -t hello-python:latest .

# Docker Docs: https://docs.docker.com/
# Docker Reference: https://docs.docker.com/reference/
docker image tag ${REMOTE_APP_NAME}:latest ${LOCAL_APP_NAME}:latest
docker image push ${REMOTE_APP_NAME}:latest

Once this is done your app should be up in your private registry on DockerHub. The example we will use the following image on Dockerhub:

docker.io/mrinasugosh/sample-python-app

Get Access to Red Hat OpenShift Workshop Cluster

Use the steps below to get access to a Red Hat OpenShift cluster.

NOTE: Cluster Allocations are limited by time on Open Labs. Please make sure to complete the labs as soon as possible Clusters will shut down approximately 3 to 4hrs after spinning up

  1. Navigate to:

https://developer.ibm.com/openlabs/openshift

  1. Select "Bring Your Own Application" Openlab Screen Shot 2021-09-24 at 11 46 20 PM

  2. You will be asked to sign in with your IBM account.

    • Sign up for a IBM Cloud Account if you don't already have one Sign up here
    • Sign in to your temporary RHOS cluster

Open Red Hat OpenShift Workshop Cluster

  1. Once you are in the lab, open the Openshift Console Screen Shot 2021-09-25 at 12 00 03 AM

  2. Switch over to "Developer Mode" by selecting the option on the left side panel Screen Shot 2021-09-25 at 12 13 09 AM

  3. Add a project workspace to run your apps Screen Shot 2021-09-25 at 12 18 07 AM

  4. Create a "demo" project Screen Shot 2021-09-25 at 12 27 11 AM

  5. Select "Container Image" as the way to create an application Screen Shot 2021-09-25 at 12 33 20 AM

  6. Type in the relevant image reference under "Image name for external reegistry" Screen Shot 2021-09-25 at 12 41 55 AM

  7. Oila! You have deployed your image as a running app on Openshift. Wait for the Pod's status to change to Running then navigate to th Network Route to launch the app