Friday, July 14, 2017

openshift - oc cluster up in specific address



When you do 'oc cluster up' , you can access openshift console using 127.0.0.1.

But if you wish to specify IP address to access your openshift console make use of --public-hostname=<IP address>

This way you can access the  cluster even from outside (but within LAN ofcourse)


# oc cluster up --public-hostname=192.168.122.152

Friday, July 7, 2017

Store and Run docker images locally



Store and Run docker images locally:


How to save image locally and use it:

// You have built an image named s3-store-build

// Now save locally
$ docker save s3-store-build > s3-store-build.tar

$ ls -ltrsh
261M -rw-rw-r--  s3-store-build.tar

// Load the image - ready to run:
$ docker load --input s3-store-build.tar

Push image to docker hub:

How to push image to docker hub:

# docker login


// build a image using Dockerfile in PWD
# docker build -t   store-build .


# docker images | grep store-build

# docker tag <db548e132e30> saran/store-build

# docker push  saran/store-build  

Thursday, July 6, 2017

Pulling docker images using url




Pulling docker images:

Generally, you pull a public URL like:

docker pull gluster/gluster-centos



Sometimes you want to directly pull the Docker image using URL:

docker pull https://hub.docker.com/r/gluster/gluster-centos/


The above can be any URL where Docker image present.

Thursday, June 29, 2017

Combine multiple commits into single one - squash your github commits




How to combine multiple commits into single one?

While carrying out a pull request, I ended up with 7 commits in the same pull request. 

I wish to combine all those 7 commits into a single one.( So it is easier to merge and unnecessary  history is removed)


# carrying out squash:

You want to squash all 7 commits into one:

# git rebase -i HEAD~7

 

It will launch a editor.

# Leave first commit as is.

# From 2 - 7 , change (edit) pick as squash

Now, It will squash the changes and launches editor for  adding commit message. (which actually contains all 7 commit messages).
You can edit the commit message as you wish.

Note: any commit message with # is comment. you need to delete unneeded commit message, else it will only add confusion.





# pushing changes:


Now, I have already pushed all those 7 commits into the github's pull request

So, I need to do force push:

# git push origin  <your branch name>  --force

that's it. :)

You can verify your github pull request.