Boot2Docker for Windows

Development environment – It can take too long to set it up

Have you ever thought that how long does it take for an entry level developer to setup a new project development environment? The answer depends on many factors  like the project age, the number of developers worked on it etc. but don’t get surprised if you get answer half a day or more.

Hey! It should be much faster than that: checkout a script and execute it. That’s all. Two steps should be sufficient to setup your environment and get ready for development.


Deployment environment – It can differ too much from testing and production environments

Have you ever skipped your build’s automated tests because they failed on your machine? Or even worst, have you ever been the cause of a build break even if your changes compiled smoothly on your machine but failed consistently on CI server?

Any slight difference can result in an unexpected behavior. Diverging can be as simple as giving a try to the last version of a framework or switching to a different project for half a day.

Finding out what makes your system behave differently is an annoying task every developer should avoid.

Welcome to the docker world!!!

What is Boot2Docker?

Boot2Docker is a lightweight Linux distribution based on Tiny Core Linux made specifically to run Docker containers. It runs completely from RAM, weighs ~27MB and boots in ~5s.

Why should we use Boot2Docker:

The Boot2Docker project smoothens the gap by bringing Docker to an otherwise incompatible platform. If you want to prepare a packageable and easily shippable program from a windows/mac environment you should use this. It allows you to run Linux containers through windows/mac.

To make this process easier, docker has designed a helper application called Boot2Docker that installs the virtual machine and runs the Docker daemon.

How would we do that?      

Setup Boot2Docker on windows to run a tomcat instance:

  1. Download docker-install.exe from
  2. Run the installer, which will install VirtualBox, MSYS-git, the boot2docker Linux ISO, and the Boot2Docker management tool.
  3. Go to GitBash from Windows start.
  4. Run the command Boot2docker up. This will bring up a LINUX VM into which we will ssh in the next step. Docker daemon would eventually be running on this VM.
  5. Run the below command to ssh into the VM “c:\Program Files\Boot2Docker for Windows\boot2docker.exe” ssh -L 8080:localhost:8080. This also specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side.
  6. Let’s run a tomcat server. This will download the server image if not already present and bring it up. docker run -it –rm -p 8080:8080 tomcat:8.0. The server will run to be accessible on port 8080 from the host.
  7. Try yourself hit http://localhost:8080.

Deploy a war to tomcat:

  1. Download winscp from
  2. Install
  3. Open GitBash window from windows start
  4. Obtain the ip address of the boot2docker VM using boot2docker ip. Default ip is
  5. Login to the VM using the default credentials.
  6. The default user is docker and the password is tcuser.
  7. FTP cloud.war(any war file) to base location on docker VM.
  8. To copy the war to the webapps folder and run the tomcat image use the following command: docker run -it -d –name tomcat -v $HOME/cloud.war:/usr/local/tomcat/webapps/cloud.war:ro -p 8080:8080 tomcat:8.0

Publish an image to a private repo:

We will be using for our private repo hosting. All the docker images your team needs can be uploaded here, to be pulled on later. You will have to sign in. Use the link

In order to publish the image, follow the steps below:

  1. The following command gets the list of containers running on the VM: docker ps. Copy the container id from here. For me it was: 910ea9ae38fe
  2. The following command gets the list of images running on the VM: docker images. Copy the image id. For me it was b5e4c1b6e097
  3. From the VM login to quay using : docker login
  4. Commit the image using the command: docker commit containerid imageid docker commit 910ea9ae38fe b5e4c1b6e097
  5. We next need to tag the container to a known image name docker  tag image id
  6. Finally lets push our image docker push
  7. Pull this image id anywhere and do a run as we did before.


One thought on “Boot2Docker for Windows

  1. Pankaj March 24, 2015 / 8:06 pm

    That’s cool. Would love to use it.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s