Docker: Deploying linux containers on Windows

Docker is a great way to containerize your applications. By using Docker, we can replicate production environment locally among many things. We often use Linux containers in this regard. The reason it can be run on either Linux/Mac machines easily.

But what if we need to setup this on a Windows machine. This post will guide you to write equivalent scripts for Windows as well.

Suppose we use the following scripts when working on Linux/Mac machines:

Linux/MacOS scripts

Suppose, following are startup & shutdown scripts for your docker containers. Suppose they are named start-container. & stop-container.:

Shutdown Script (stop-container)

Startup Script (start-container)

Running on Windows?

The scripts mentioned above will not work on Windows. This happens due to some of the following reasons:

  • Command line scripts dont use the same architecture.
  • The commands need to be re-written for a separate platform.

Windows scripts (Solution)

Following are the startup & shutdown scripts for running your docker containers on Windows. Suppose they are named start-container.bat & stop-container.bat:

Shutdown Script (stop-container.bat)

Startup Script (start-container.bat)


Laravel two-factor authentication

Two-factor authentication in Laravel

Two-factor authentication offers a way to add extra protection layer for your website’s user accounts. This allows your users to protect their accounts from unauthorized access. There are many providers that offers such services. In this post, we will use Authy. Authy provides a very robust API for implementing two-factor authentication. You can find API documentation for Authy here.

First you must install composer & create a new laravel application.


  • Use following command to install:

  • Add following to $providers array in config/app.php:

  • Add following to $aliases array in config/app.php:

  • Publish configuration:

  • Migrate user table changes to database:

  • Add the following lines to User model (e.g App\User.php)
    • Before the class declaration, add these lines:

  • Now the change the class declaration. For example, if your class declaration is

to this:

  • Now change the import traits line accordingly in user model file. For example if the line is:


  • Lastly, add/update $hidden variable to hide ‘two_factor_options’ field from any DB call for user detail:


You can view further documentation for this plugin here.

I have also implemented it in a sample laravel application as well. You can view installation instructions here. Through this application, you can do:

  • User login & registration.
  • Enable/Disable two-factor authentication for a user.

Following are the download links for the laravel demo application with two-factor authentication:


Install Nodejs from standard binaries in Linux

Install Nodejs from standard binaries in Linux

In this post, i will show you how to install Node.js from standard binaries( in Linux.

First check your system architecture with following commands:

On my system, the above two commands gave output 64 and x86_64 respectively. This means i need to install 64-bit version of Node.js.

Now lets download the latest version of Node.js from The current LTS release is 4.2.2.

After file is downloaded, run the following command to install Node.js

The above command will install node & npm in “/usr/local/bin“. You can check whether its installed by typing following commands:


Insufficient permission for adding an object

Insufficient permission

I got the following error when doing git pull:



Again stackoverflow comes to the rescue. To correct the issue, i only had to do this: