Useful docker aliases and functions

If you are using docker in Mac as I do , you will find these aliases very useful in your day to day use of docker. Please add it to ~/.docker_aliases and add docker_aliases to your shell’s rc file like .bashrc.


# ------------------------------------
# Docker alias and functions
# ------------------------------------

# Get latest container ID
alias dl="docker ps -l -q"

# Get container process
alias dps="docker ps"

# Get process included stop container
alias dpa="docker ps -a"

# Get images
alias di="docker images"

# Run deamonized container, e.g., $dkd base /bin/echo hello
alias dkd="docker run -d -P"

# Run interactive container, e.g., $dki base /bin/bash
alias dki="docker run -i -t -P"

# Execute interactive container, e.g., $dex base /bin/bash
alias dex="docker exec -i -t"

# Stop all containers
dstop() { docker stop $(docker ps -a -q); }

# Remove all containers
drm() { docker rm $(docker ps -a -q); }

# Stop and Remove all containers
alias drmf='docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)'

# Remove all images
dri() { docker rmi $(docker images -q); }

# Dockerfile build, e.g., dbu tcnksm/test
dbu() { docker build -t=$1 .; }

# Show all alias related docker
dalias() { alias | grep 'docker' | sed "s/^\([^=]*\)=\(.*\)/\1 => \2/"| sed "s/['|\']//g" | sort; }

# Bash into running container
dbash() { docker exec -it $(docker ps -aqf "name=$1") bash; }

HOWTO run your blog on github for free

I have been meaning to do this for a long time. I used to run my blog on a WordPress instance in bluehost.com and it was painful to keep the wordpress site up to date and I finally gave up and stopped blogging altogether. I am now back online using github pages to blog and what follows is a quick howto on getting you up and running on github pages. And the whole setup is completely free.

Github Pages allows you to host a static site directly from your github repository. It uses the Jekyll static website generator.

Before we get started, you will need the following pre requisites:

  • Docker community edition for your platform. We will use docker to run Jekyll locally when you are authoring a new blog post or adding pages to your site.
  • Free disqus account. You will need a disqus account if you want the option for people to leave comments on your blog posts.

Start with a new repository in your github account with the same name as your blog url, for eg., mine is chandraonline.github.io. Your repository name should be your your-username.github.io.

Copy over the files from the Scaffold Repository to your repository to get started with your own blog. You can either clone the scaffold directory and copy over the files or download the zip file from github.

Setting up disqus comments

Head over to disqus.com and create a new site. You will find install instructions for jekyll which you can follow to get the universal embed code. You should then copy the embed code in _includes/comments.html and change the disqus site name in _layouts/default.html.

Configuring your blog

You can update _config.yml to configure the blog title, author etc.

To test the jekyll site, simply run :

docker-compose up

You should be able to go to http://0.0.0.0:4000 and test your blog locally.

When you make changes to your posts or add new posts , it will show up in the local site automagically. If you are not seeing changes in the local site (for eg when you do changes to _config.yml, simply remove all files under _site/ and restart with the docker-compose up.

Once you are satisfied with the changes , you can push the changes to github.com and it will automatically build the jekyll site and make it available at your-user-name.github.io.

How I got phished by an 8 year old

I would like to consider myself a tech savvy individual that knows a thing or two about security. But for what its worth I got phished by my 8-year old son. Like all busy parents in this 21-st century, we let our iPad be the Nanny when we want some quiet time in the house. To feel less guilty about this habit of handing a gizmo to keep them occupied, I have severely restricted what they can do with it. We have also secured it with a Pin so either my wife or I can unlock it when we think they can play with it. Now this goes for a week or two and clearly my twins are not too happy about this arrangement. One day while I am busy doing something else one of them asks me to enter the passcode to continue playing and I enter the passcode for him and get back to what I was doing. Later that day, much to my surprise my pin does not work on the iPad anymore and my son has that It-wasn’t-me-look on his face which of course means that he has everything to do with it. After some serious you-better-tell-me-what-you-did conversation, he admits he changed the pincode. The little brat made me enter the passcode in the change passcode screen and changed the passcode! While I was pretty mad when it happened, thinking back it was also a proud father moment to get phished by your 8-year old son :). Kids these days…..