DEV Community

Cover image for ๐Ÿ‹ ELI5 Docker: Easy Docker Concepts in 5 Minutes!
Sahil Bondre for dev::unfiltered

Posted on • Originally published at devunf.netlify.app

๐Ÿ‹ ELI5 Docker: Easy Docker Concepts in 5 Minutes!

A Story

Let's start with a story first. Mary was a painter in the Medieval era who was really good at drawing portraits. She wanted some career change. Nature was more exciting to her than the faces of people. So she decided to travel. She travelled all the way to the beautiful Fjords in Norway for some inspiration.

Fjords

Photo by Robert Bye on Unsplash

She quickly realized that the environment around her was not suitable.
It was way too cold. Norwegian food wasn't her favourite either. And she couldn't work without her canvas and pigments.

She came up with a plan. On a piece of paper, she noted all the things she needed to live, eat, sleep, and paint in the foreign land. She further listed where to get them and wrote the steps to build a small abode to live and work for a few weeks peacefully.

She went to Amazon (the internet was built in Renaissance!), fetched all the things and made her a small cabin according to her paper's recipe. She then could work peacefully in an environment that was suitable to her. A few days later, a friend who fancied changing jobs wanted to join her too. Mary then gave the page containing the instructions to John. Since all the ingredients and steps were already documented, John made his own cabin in no time and got to work in Norway too. End of story!

Cabin in Woods

Photo by Olivier Guillard on Unsplash

What's Docker

Let's get back to Docker now:

The painters in the story are like the programs that we write. They might work correctly on our machine but maybe not on someone else's computer. The other system may have a different version of Python or Node, different pre-installed packages or even a completely different OS. As in the story, our applications won't work in a completely different environment, so we need to build a small cabin to do their job comfortably. These are known as Images.

Docker Images

Docker Images include our application's source code and all the tools, libraries, and packages that it needs to run. We can run these Images as an instance of a Container.

Docker Container

A Container is a lightweight, independent, executable software package with everything you need to run the application. Images are more of a blueprint, and Containers are more like an executable file.
Remember the page that Mary had made? In the Docker world, we call it the Dockerfile.

Dockerfile

A Dockerfile is a text file that includes the recipe to build the Docker Image. It specifies the OS, languages, environmental variables, file locations, network ports, and other components that our app requires.

Mary could build everything she needed with the help of Renaissance Amazon. Now that's like Docker. To quote the official documentation:

"Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications."

Docker Registry

Now let's assume she posted a picture of her page with the recipe (along with links to Amazon) on her Medieval Blog so other people can use it, that would be an example of a public Docker Registry.
A Docker Registry is where the Docker Images are stored. The registry can be either private or public. Several people can collaborate and share images by uploading them to the registry.
One such example of a Docker registry is the Docker Hub. What Github is for code, Docker Hub is for Docker Images.

Next Steps

So, I've covered all the basic concepts that you'll require to get started to use Docker. There are several resources on the internet from where you can learn docker. I'll list down a few that I've used personally:

Installing Docker

The Docker suite contains two principal tools: Docker Engine and Docker Desktop.
The Docker Engine is the core set of docker tools required to run docker commands and containers on your machine.

Docker Desktop is a GUI that talks to the underlying Docker Engine to make your life easy.

What's next?

Docker is among the first steps to learn about Microservices and DevOps. You can start learning about the microservice vs monolith philosophy, container orchestration, Kubernetes there's lots and lots of great stuff to learn!


๐ŸŒŸ Thank's for reading! I'd love to hear any feedback, opinions, and ideas for what I should write on next.
๐Ÿ˜„ Have a wonderful day!

Top comments (1)

Collapse
 
ranggakd profile image
Retiago Drago

Can you pinpoint where the Docker-Compose part would fit in your story? I'm still a little bit confused about the relationship between dockerfile and docker-compose