This week hasn't been very productive for my Docker journey, but I still learned a couple of things. So, this article will likely be shorter.
Past Learnings
I have already learned a lot about the theory behind Docker containers, images, registries, and Docker's architecture. Additionally, I have launched some of my first containers. It has been an enlightening journey with its own ups and downs, errors, and successes.
Going Forward
Learning has been limited this week due to some unavoidable circumstances. However, I did manage to learn a few things, which I will discuss in detail in this post. This includes gaining a deeper understanding of the Docker registry and Docker Compose. Also, I learned to build my first image and push it to a Docker registry.
Docker Registries: Treasure house of Docker
To put it simply, a Docker registry is a central place where Docker images are stored. It's similar to GitHub, which is a central place for storing code. The most popular Docker registry is DockerHub, a public registry. However, registries can also be private, and we can create our own if needed. One of the key points that I learned during the study of registries was the differentiation between a registry and a repository in terms of Docker.
Simply put, a Docker registry is a place where all kinds of Docker images are stored, while a Docker repository is a subset of a Docker registry where related images are stored together. Below is an image that clarifies the difference between these very similar terms:
Building an image and pushing it to DockerHub
This was the most fun part of this week. After learning a lot about images, it was finally time to build one and push it to DockerHub, Docker's own public registry. Below are some images of my attempts at building, running, and pushing an image to DockerHub:
Docker Compose: The superstar of Docker (IMO)
During my previous practicals, I have used Docker Compose to run containers without really understanding what it does. But now, I can say that I have a pretty good initial understanding of Docker Compose.
Most of the times, an application may consist of multiple containers. But then, how do you run these containers together in such a way that they can interact with each other flawlessly? The manual way would be to run all of these containers one by one, build a network among them, feed each of these containers their respective environment variables, expose different ports to each of them, and so much more. All of these seems like a lot to do, and trust me, I did look upon the manual way over the Internet, and it is indeed a overwhelming task.
This is where Docker Compose comes to the rescue. Docker Compose manages everything needed to run a multi-container application. All it needs is a single YAML file with all the configurations of each container, and Docker Compose does everything flawlessly. I am really grateful to Docker Compose for making our lives much easier. Below are some examples of me using Docker Compose to build multi-container applications. Docker Compose really makes it easy to manage multi-container applications.
Conclusion
Even though I feel this week's learning was not up to the mark as I would have wished, I am still glad that I could learn something. It's been really fun doing all the hands-on stuff from time to time, along with the theoretical stuff. For next week, I hope I can learn more amazing things. Until next time, then!