Beginner’s guide to docker.

Atibhi Agrawal
3 min readApr 3, 2021

I remember the first time I used docker. My teammates and I were building a flask application on our linux machines for our software production engineering course. One of my teammates used Windows and was having problems setting up the environment on her machine. Our Teaching Assistant had a MacBook and we were worried if our flask application would work for him. He suggested that we use docker for portability. We dockerized our application and incorporated it into our CI/CD pipeline such that after a successful build the updated docker image would be pushed to dockerhub. Everyone could then simply pull the image and get started.

In this post, I am going to talk about the basics of docker, why it is so popular, how it can help your application as well as suggest some resources for getting started.

Before diving into docker, it is imperative that you know what containers are. Most developers want to keep their applications separate from each other so that they do not interfere with each other’s operations. This can be achieved using virtual machines which keep applications on the same hardware completely separate. However, virtual machines are not light weight and typically take up to gigabytes of storage. Maintaining and upgrading them is also cumbersome.

In contrast, containers share the same underlying Operating System kernel and also separate out the application’s environments. A container is a standard unit of software that packages up code and all its dependencies so that the application runs quickly and reliably from one computing environment to another.[1] They take up to megabytes of storage and are lightweight.

Virtual Machines vs Docker

What Is Docker ?

Docker is an open source project that packages software into containers that have everything that the software needs to run including code, runtime, system tools and libraries.[2] If you want to dockerize your application, you would first need to write a Dockerfile. It is a text document that contains all the commands that you would type on the command line to assemble a docker image. A docker image is a static read-only template that contains a set of instructions for creating a container that can run anywhere. It also provides a convenient way to package applications. Next, you can use the docker run utility to launch a container. Each container is an instance of an image. Building Docker Images with Dockerfiles is a good resource to learn how to build docker images with Dockerfiles.

Building a docker container

Building docker images is simple, however you do not have to build every image from scratch. You can download container images from docker hub. It is a saas repository that allows users to share container-based applications.

Why Is It So Popular ?

Docker has become immensely popular in recent times due to lower resource usage, its portability and fast deployment. Continuous Integration and deployment has become a very important part of the DevOps lifecycle. Docker plays an important role in CI/CD by allowing developers to set up local development environments identical to a production server, run multiple dev environments on the same host with different configurations and also allows everyone on a team to set up the same project with the same configuration regardless of their host environment.

Conclusion

In short, docker can get you more applications running on the same host, making it easier for you to develop containerized applications as well manage and deploy your applications. It is no surprise that most companies are looking to move their applications to containers and more specifically docker. The official guide of docker is a great place to get started. It shows you how to dockerize a sample application. You can get started with Docker right away on Learn Docker & Containers using Interactive Browser-Based Labs which provides an interactive web based tutorial. Once you are familiar with docker, check out this list of exhaustive tutorials and explore more about docker.

References

[1] https://www.docker.com/resources/what-container

[2] https://www.docker.com/

[3] https://www.infoworld.com/article/3204171/what-is-docker-the-spark-for-the-container-revolution.html

[4] https://dzone.com/articles/50-useful-docker-tutorials-for-it-professionals-fr

--

--