Multi-stage Docker Image Build for Java Applications

A few days back, I discovered a new Docker feature — multi-stage builds. The multi-stage build feature helps you create thin Docker images by giving possibility to divide image building process into multiple stages. Artifacts produced in one stage can be resused by another stage. This is very beneficial for languages like Java as multiple steps are required to build the Docker image. The main advantage of multi-stage build feature is that it can help you create smaller size images. This feature is not yet available in stable versions of Docker. It will become available in Docker 17.05. To use this feature, you have to use edge version of Docker CE.

To build a Docker image for a Java application, you first need to build the Java project. Java build process needs JDK and a build tool like Maven, Gradle, or Ant. Once Java binary artifact is produded, you can package the binary in a Docker image. For running a Java binary, you only need JRE so you don’t have to pay the cost of bundling the whole JDK.

You can read full blog at

5 Docker Utilities You Should Know

There are a lot of cool Docker utilities that you can find on the web. Most of these are open source and available on Github. I have become an active user of Docker for last two years, using it for most of my development projects. As you start using Docker, you will find Docker is suitable for more use cases than you initially envisioned it for. You will want Docker to do a little more for you, and it will not disappoint you.

Docker community is very active, a lot of useful utilities keep popping daily. It is difficult to keep check of all the innovation happening in the community. In the following post, I have collected some interesting and useful Docker utilities which I use in my daily work. These utilities makes me more productive, otherwise would have been a manual work.

In this post, I will cover watchtower, docker-gc, docker-slim, rocker, and ctop utilities. You can read full blog at

Inspiring Ordinary People – part 1

Yesterday, while roaming around Delhi streets I found an old man feeding pigeons near Humayun road traffic light. What caught my attention was the dedication old man showed in cleaning dirty utensils. Birds drink water from these utensils. Old man cleaned them properly without worrying about scorching heat. I consider him a real inspiration and want to thank him for his service. I don’t know his name but he deserves a place in my blog. Thank You.

Learn To Say No

Time and again I end up discussing about importance of saying No with my friends and colleagues. I believe that yes should not be the answer to most requests that comes our way. Still, most of us end up saying yes out of obligation or just to be accepted and part of the crowd.

Yes has no meaning if we never say No.

Saying No to most of the choices help me focus on few things. There is no point in becoming jack of all traits and master of none. This is a lesson that I have learnt after wasting many years playing with many things.

Why we say Yes?

There are many social and psychological reasons why saying yes is much more easier than saying No.

  1. You want to oblige to people so that you don’t hurt their feelings.
  2. You don’t want to be excluded from social group.
  3. You don’t want to be alone.
  4. You don’t want to disrespect your elders.
  5. You don’t want to hurt anybody’s feeling.
  6. You don’t have guts to face the truth.
  7. You don’t want to explain your rationale behind saying No.

Saying No Makes You Say Real Yes

When you don’t do something, you have option to do something else. Richie Norton beautifully articulated in his quote

Say no to everything, so you can say yes to the one thing.

You work on tasks that you truly believe in. You go out with people you want to spend your time with. You behave the way you are. You are not faking or putting a mask to be liked by other people.

Saying No Simplifies Life

Life is a mess these days with so many options to choose from and so many things to say. We are living in a world of information overload so we have to limit ourselves to few things to make it easy for us to digest and not get influenced. You start making right choices evaluating all the options you have and picking something you truly believes in.

Say No Without Having To Explain Yourself

Stephanie Lahart summed up very well

Let today mark a new beginning for you. Give yourself permission to say NO without feeling guilty, mean, or selfish. Anybody who gets upset and/or expects you to say YES all of the time clearly doesn’t have your best interest at heart. Always remember: You have a right to say NO without having to explain yourself. Be at peace with your decisions.

Saying No does not mean you are selfish

When you start saying No, people will start perceiving you as a selfish person. I don’t think caring about your needs and time is selfish. Even if it is considered selfish it is for your own good. If you can’t do good to yourself, you can’t do go with others as well. Suzette Hinton put it beautifully in following lines:

We must say no to what, in our heart, we don’t want. We must say “no” to doing things out of obligation, thereby cheating those important to us of the purest expression of our love. We must say no to treating ourselves, our health, our needs as not as important as someone else’s. We must say no.

Even Steve Jobs Believe In Saying No

Working through sbt test deadlock

Today, I encountered an issue while running tests for one of my Scala SBT projects. Each time, ran sbt test command hang. After running jvisualvm, I discovered that it is due to thread deadlock. I couldn’t figure out why deadlock is happening. Test cases worked fine when ran individually. To work through this issue, I disabled parallel execution of tests.

From command-line, you can use following command to disable parallel execution of test:

$ sbt 'set parallelExecution in Test := false' test

You can also set this setting in your build.sbt to avoid setting this setting manually.In your build.sbt , add the following line.

parallelExecution := false

Hands-on guide for building Serverless applications

Yesterday, I released hands-on guide to building Serverless applications using AWS Lambda and Serverless framework. The guide is open-source and available on Github. Checkout the guide and please give feedback.

Serverless is an overloaded word. Serverless means different things depending on the context. It could mean using third party managed services like Firebase, or it could mean an event driven architecture style or it could mean next generation compute service offered by cloud providers or it could mean a framework to build Serverless applications. This series will start with an introduction to Serverless compute and architecture. Once we learned the basics, we will start developing application in a step by manner.

Read more