How I started Docker
This is a story basically about my first encounter with Docker. How I started playing with docker with just one motivation and how I fell in love with the technology soon after.
So, I was coming back from office as usual. I had heard a lot about Docker in the past, but never had the motivation to get started assuming it would be complex and therefore, need a lot of time. Then on the night, one of my colleagues (also our co-founder) tweeted that “we are starting to experiment with Docker and that one of my another colleague will lead it". I was very happy, finally this could lead to my first encounter with Docker. I reached home at around 7 PM and I thought “wait, why not start today itself". At around 8pm, I started browsing blogs, going through their official documentation, etc. Very soon (like it happens with love at first sight) I was falling in love with Docker. From there on, I knew that tonight it has to be only the 2 of us.
After reading different blogs, I wanted to give Docker a try as I always feel with technology both understanding the concept and applying are equally important. Installation is always simple, downloaded the hello-world image and created my first container. I cannot express myself in words, the feeling of something working in the first go. It was wonderful. I went ahead and downloaded ubuntu image. I tried to build the container from it, but there was some error. I tried to debug it and went through so many links on the internet but to no avail. I was not getting a solution. I was very motivated and had to fix this error anyhow. I spend around 2 hours in debugging but there were no results. Finally a thought came in my mind, let's delete the image and try to download it again and now it worked like a charm. I was happy, actually very happy.
Now I looked at the time, it was mid night. And, I was in no mood to call it night yet. A little tired but then I was enjoying something new. Then I started reading about how we can build an image using Docker. Till now I was not having any purpose, but now I had one - why should I learn Docker. Actually we were facing many problems in our organization and the major problem which we faced was sync b/w the local and development environments. Me and my colleagues used to complain a lot with phrases like “wtf, it was working on my local but now it was not working on the dev site” floating all through the day. I thought maybe this is the best use of Docker.
Life was easy till now and now I had a motive, motivation and yes Docker with me. So I started building an image to understand how it works. I started with apache2 web server and made the image successfully. Everything was working fine, but there was a problem with the image. Apache2 was not getting started automatically, for starting the apache2, I had to go to start the terminal of my container, need to execute the start command for apache2. I tried a lot to run apache2 automatically, but I was not having any luck that time. But as we say fortune favors the brave, I went to IRC and asked for the solution. One guy told me to use the CMD instruction and run apache2 in forground using /usr/sbin/apache2 -D FOREGROUND, and voila it worked !!! All of sudden I looked at the time, it was 5 in the morning. A moment full of joy and satisfaction. Of course, I was not feeling sleepy yet but I wrapped it with the promise of doing experiments daily.
This is how I fell in love with Docker with that one tweet and this one night stand! It’s amazing to fell in love over and over again, that’s the beauty of it. You never get enough. I’m gonna stick with this for some time until something more beautiful and promising knocks my door :)
I would share my experience in Docker and Drupal blog series in upcoming days. Till then Happy Dockering.. :)