Last active
April 6, 2017 06:00
-
-
Save brgnepal/dad6cb036a3d8c42d24ab7a0fb465a7d to your computer and use it in GitHub Desktop.
Staging your application with the OpenShift registry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker version | |
Client: | |
Version: 17.03.0-ce | |
API version: 1.26 | |
Go version: go1.7.5 | |
Git commit: 3a232c8 | |
Built: Tue Feb 28 08:18:40 2017 | |
OS/Arch: linux/amd64 | |
Server: | |
Version: 17.03.0-ce | |
API version: 1.26 (minimum version 1.12) | |
Go version: go1.7.5 | |
Git commit: 3a232c8 | |
Built: Tue Feb 28 08:18:40 2017 | |
OS/Arch: linux/amd64 | |
Experimental: false | |
$ minishift start | |
Starting local OpenShift cluster using 'kvm' hypervisor... | |
Downloading ISO 'https://github.com/minishift/minishift-b2d-iso/releases/download/v1.0.2/minishift-b2d.iso' | |
40.00 MB / 40.00 MB [============================================================================================================================================================] 100.00% 0s | |
19.96 MB / 19.96 MB [============================================================================================================================================================] 100.00% 0s | |
-- Checking OpenShift client ... OK | |
-- Checking Docker client ... OK | |
...... | |
You are logged in as: | |
User: developer | |
Password: developer | |
To login as administrator: | |
oc login -u system:admin | |
$ eval $(minishift docker-env) | |
$ docker version | |
Client: | |
Version: 17.03.0-ce | |
API version: 1.24 | |
Go version: go1.7.5 | |
Git commit: 3a232c8 | |
Built: Tue Feb 28 08:18:40 2017 | |
OS/Arch: linux/amd64 | |
Server: | |
Version: 1.12.3 | |
API version: 1.24 (minimum version ) | |
Go version: go1.6.3 | |
Git commit: 6b644ec | |
Built: Wed Oct 26 23:26:11 2016 | |
OS/Arch: linux/amd64 | |
Experimental: false | |
$ export PATH=~/.minishift/cache/oc/v1.5.0-rc.0:$PATH | |
$ oc whoami | |
developer | |
$ docker login -u developer -p `oc whoami -t` 172.30.1.1:5000 | |
Login Succeeded | |
$ docker images | |
REPOSITORY TAG IMAGE ID CREATED SIZE | |
openshift/origin-deployer v1.5.0-rc.0 4855078162ee 3 weeks ago 647 MB | |
openshift/origin-docker-registry v1.5.0-rc.0 e6a1250d6275 3 weeks ago 458 MB | |
openshift/origin-haproxy-router v1.5.0-rc.0 a09fecd1344d 3 weeks ago 760 MB | |
openshift/origin v1.5.0-rc.0 277553fa0d1d 3 weeks ago 647 MB | |
openshift/origin-pod v1.5.0-rc.0 efe898ce8bbe 3 weeks ago 1.14 MB | |
$ git clone https://github.com/openshift/ruby-hello-world | |
Cloning into 'ruby-hello-world'... | |
remote: Counting objects: 275, done. | |
remote: Total 275 (delta 0), reused 0 (delta 0), pack-reused 275 | |
Receiving objects: 100% (275/275), 42.54 KiB | 58.00 KiB/s, done. | |
Resolving deltas: 100% (89/89), done. | |
Checking connectivity... done. | |
$ cd ruby-hello-world | |
$ docker build -t budh-ruby-ex . | |
Sending build context to Docker daemon 126.5 kB | |
Step 1 : FROM centos/ruby-22-centos7 | |
latest: Pulling from centos/ruby-22-centos7 | |
.... | |
Successfully built 8b6e5b0151e6 | |
$ cd .. | |
$ docker images | |
REPOSITORY TAG IMAGE ID CREATED SIZE | |
budh-ruby-ex latest 8b6e5b0151e6 21 seconds ago 457 MB | |
centos/ruby-22-centos7 latest c6523d576713 2 weeks ago 445 MB | |
openshift/origin-deployer v1.5.0-rc.0 4855078162ee 3 weeks ago 647 MB | |
openshift/origin-docker-registry v1.5.0-rc.0 e6a1250d6275 3 weeks ago 458 MB | |
openshift/origin-haproxy-router v1.5.0-rc.0 a09fecd1344d 3 weeks ago 760 MB | |
openshift/origin v1.5.0-rc.0 277553fa0d1d 3 weeks ago 647 MB | |
openshift/origin-pod v1.5.0-rc.0 efe898ce8bbe 3 weeks ago 1.14 MB | |
$ docker tag budh-ruby-ex 172.30.1.1:5000/myproject/budh-ruby-ex | |
$ docker push 172.30.1.1:5000/myproject/budh-ruby-ex | |
The push refers to a repository [172.30.1.1:5000/myproject/budh-ruby-ex] | |
7ec7d5d08d03: Pushed | |
b83e6d720324: Pushed | |
1426aacc44f6: Pushed | |
44c20240b7e7: Pushed | |
1f44f6fd1b03: Pushed | |
384a388d1859: Pushed | |
7ad6d4ef0789: Pushed | |
8a72440d44e4: Pushed | |
d2a3a8b22972: Pushed | |
e750fbf8b515: Pushed | |
34e7b85d83e4: Pushed | |
latest: digest: sha256:974b3615976d9dc0c31039ac62a8d7130dc6b47709bd80f5c7ddbb296713e92a size: 23691 | |
$ oc new-app --image-stream=budh-ruby-ex --name=budh-ruby-app | |
--> Found image 87f70ea (2 minutes old) in image stream "myproject/budh-ruby-ex" under tag "latest" for "budh-ruby-ex" | |
Ruby 2.2 | |
-------- | |
Platform for building and running Ruby 2.2 applications | |
Tags: builder, ruby, ruby22 | |
* This image will be deployed in deployment config "budh-ruby-app" | |
* Port 8080/tcp will be load balanced by service "budh-ruby-app" | |
* Other containers can access this service through the hostname "budh-ruby-app" | |
--> Creating resources ... | |
deploymentconfig "budh-ruby-app" created | |
service "budh-ruby-app" created | |
--> Success | |
Run 'oc status' to view your app. | |
$ oc status | |
In project My Project (myproject) on server https://192.168.42.100:8443 | |
svc/budh-ruby-app - 172.30.162.116:8080 | |
dc/budh-ruby-app deploys istag/budh-ruby-ex:latest | |
deployment #1 deployed 6 seconds ago - 1 pod | |
View details with 'oc describe <resource>/<name>' or list everything with 'oc get all'. | |
$ oc get pod | |
NAME READY STATUS RESTARTS AGE | |
budh-ruby-app-1-cm36f 1/1 Running 0 6s | |
$ oc expose svc/budh-ruby-app | |
route "budh-ruby-app" exposed | |
$ minishift openshift service budh-ruby-app -n myproject | |
Opening the service myproject/budh-ruby-app in the default browser... | |
$ Created new window in existing browser session. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment