Basic Docker Setup with Openshift

 

Goals

 

To getting started with installing and running Docker which leverages Docker containers to enable IT operations teams and Development teams to build, ship and run any application, anywhere

 

What we expect in this Getting Started DCK001:

  1. Researching skills on new technology

  2. Understanding of how to use docker with openshift

 

Tasks

 

What you will do in this Getting Started DCK001:

  1. Learn to install and use docker

    1. Install docker from: https://docs.docker.com/engine/installation/linux/ubuntu/

    2. Start service docker and check if it is running

  2. Learn to use openshift origin:

    1. Install Openshift Origin from: https://github.com/openshift/origin/releases/tag/v3.6.0-alpha.2 (the latest version at the date of this document created)

    2. Install the package based on your operating system (ubuntu)

    3. Extract the file and use command oc

    4. To make it executable: chmod +x oc

  3. Using Docker with Openshift

    1. Starting Openshift origin cluster: ./oc cluster up

    2. Creating new openshift origin project: ./oc new-project ocr

    3. Creating new app inside of the project: ./oc new-app https://npsopheak@bitbucket.org/MarcAW/ocr.git --strategy=docker

      1. Replace the repo by your repository link

    4. Navigate to web console at: https://127.0.0.1:8443

    5. Login as developer: Username: developer and password: developer

    6. Edit Source build to allow build to work correctly with git

 

  1. Edit source secret for the git source

    1. Before adding to the YAML, create a secret in command line: ./oc secrets new-basicauth SECRETNAME --username=GITHUB_USERNAME --password=GITHUB_PASSWORD

    2. Add the source secret to YAML

  1. (Look for line around 28 and your github link.) (This screenshot, it is using bitbucket)

  2. Go back to the build and Start Build again

    1. You can check the build log to see if the build is working correctly or not.

  1. To able to run the docker as web server we need to expose route service to export internal port to external port.

    1. Using this command: ./oc expose dc ocr --port=1337 --target-port=1337

    2. Create route for the exposed service from above.

  2. Note:

    1. When it build with docker every line of code is cached

    2. So if you add a new line at the end of the Dockerfile, all the others will be taken from cache but if you change at the beginning, then all the other line will need to run again which will take an hour.

    3. Docker is a lot of layers build one on top of another

Stay tuned

Let the news come to you

Best video from Flexitech

UNCHARTED 4: A Thief's End - Multiplayer

2 years ago

SoftKinetic 3D Vision Technology

2 years ago

Microsoft Surface Book, a rival to Apple's Mac Book has arrived

2 years ago

Jibo, The World’s First Social Robot for the Home

2 years ago

The Ultimate Race Bike: new Trek Madone

2 years ago