DEV Community

Cover image for Two ways for beginners to start using Docker to increase developer productivity

Posted on • Updated on

Two ways for beginners to start using Docker to increase developer productivity

Hii.. thanks for stopping by. What you will find in this post:

  1. What is docker? What does it solve?
  2. Why should you know about docker?
  3. Three ways in which you can start using docker every day.
  4. Why you should learn docker and have it in your dev toolbox.

Before we come to what's in this for you as an individual, a quick introduction to docker, and the problem it's trying to solve:

Docker is a software platform for building applications based on containers — small and lightweight execution environments that make shared use of the operating system kernel but otherwise run in isolation from one another.

Four phases from the above sentence sum it well. Docker provides a:

  1. small and lightweight
  2. isolated
  3. execution environment
  4. based on "containers"

What does this mean? It means that with docker you can package your application, along with the environment to run it.

Why is this a big deal? Because before containers, people used to just share the application binary. When Jenna sends Ria a program that she wrote and compiled, this is what might happen before docker:


It didn't happen just between the developer and QA, but it was happening everywhere. QA tested the program, but when he deployed the program into production it broke because... for example, he had node v12 on his test system, while in production they were still on node v10.

Or maybe you wrote your awesome code on a Mac OSX 11.3 but someone wants to run it on his Ubuntu 18.04 where node is not even installed. Bleh.

Yuck. It was a total mess! And the solution? Package the program as well and the environment together. And thus was born containers.

Alt Text

You can package your application along with all its dependencies into a docker container.

But why should I know about docker?

Now you might be telling, "Hey, I am good without docker because I don't have these sort of problems to deal with".

Hmm. Not really, buddy. People have already packaged a lot of applications as Docker images and have made them publicly available. So you can use docker to grab and use any software when required.

How you can use docker in day to day life?

These are some ways in which you can take advantage of docker to boost your own developer productivity. These are three ways in which I leverage docker.

1. No more need to install software on your laptop.

I'm just making this up, say one fine morning, someone comes to you and says that you need to install and run a new type of database named "FoobarDB" on your laptop... now that you know about docker, you just go to google and type "foobardb docker". You do get the docker image name, and then type in:

docker run foobardb
Enter fullscreen mode Exit fullscreen mode

That's it. FoobarDB is up and running on your machine. How awesome is that?

What if you want to run multiple versions of the same DB at the same time. Fret not,

docker run foobardb:6.2
docker run foobardb:3.2
docker run foobardb:8.2
Enter fullscreen mode Exit fullscreen mode

I mostly use it to run databases, so for example, if you want to run Postgres:

Alt Text

Almost anything you need for development is available through 100s of images, created either by official maintainers or the community.

Here is the Postgres image on DockerHub. Instructions and different configurations for the images are available along with it on DockerHub.

Now that you know about this, next time you are looking at different ways of installing software, take the docker route if they provide docker images:

Alt Text

2. Get a Linux environment on your Mac.

I am a Linux lover but have to use a MacBook at work. There are things that I like to do from a linux shell, so I have a ubuntu image running:

docker run -d --name myubuntu ubuntu 
Enter fullscreen mode Exit fullscreen mode

This is where "lightweight" and "environment" helps...

Alt Text

You get the full ubuntu "environment", but since it's just an environment, it's lightweight, you get the entire OS feel, and it takes under 5MB when not being used!

To summarise, docker is awesome, I wanted to cover the absolute basic usage of Docker in this post. It's highly recommended that you start using it, there are a lot of other advanced things that you can do to achieve it.

  1. No software needs to be installed locally. So the system is clean.
  2. You can run multiple version of the same software.
  3. You can delete the container and start fresh anytime.
  4. Dependencies for any software is packaged along with it.
  5. Docker is production-ready software.
  6. There are hundreds of public images available for almost anything that you need for software development.
  7. Docker images/containers are platform-independent. So you can generate a docker image/container on a Linux machine and run it on windows/mac / any other os supported by docker.

I'd love to know in the comments about other ways you've seen docker being used to improving dev productivity. Thanks for reading. :)

I do 1-1 mentoring for young developers, you can book a slot here if you are interested.

Top comments (1)

mubasshir08 profile image

Thank you so much for presenting the important of docker in a awesome way. I read your full article and now I am very excited about it. Thank you again