In this blog, I will be sharing what I gained from learning Docker with you and will share my complete experience of learning and using Docker for production purposes.
Docker is a tool that is widely used in DevOps, software development, testing, big data, microservices, IoT, cloud computing, etc. but as far as the scope of this blog series is concerned let's keep it to DevOps and a bit towards some AWS services.
So let's start with the very basic: What is containerization?
Let's take an example, you want to transport a puzzle to your friend via a ship. You can either complete the whole puzzle and then send it or you can send it as it is along with all the instructions on how to build it.
Docker works in the same way and therefore the logo is that of a container. What Docker does is it packages all the dependencies into one file which can be shared easily.
Containerization is a technology that allows you to bundle an app and all of its dependencies into a single, compact unit known as a container. This container can then be run reliably across multiple environments, from your home computer to a production server.
To understand containerization, relate it to traditional software deployment approaches. In a typical deployment, an application and all of its dependencies (such as libraries and frameworks) are stored on a server. However, this can generate issues since various apps may rely on different versions of the same dependency, resulting in conflicts and making the program difficult to maintain and grow. In simpler terms, suppose you’re working on version 3.0 of Python and your friend is working on the 2.0 version, so it might happen that the app you were developing might not work on his system.
Containerization involves the creation of a container that contains everything the program requires to execute, including its dependencies. This is a container.
Installation
Installing Docker is simple and can be done following the documentation given in the Docker Installation guide.
Important things to remember is for Mac with an Intel chip you need to have macOS version 11 or newer and at least 4 GB of RAM.
For Mac Apple silicon, you need to install Rosetta first, which converts apps made for Intel chips compatible with Apple Silicon.
Docker Images
Docker images are templates that contain a set of instructions for creating a Docker container. They are essentially a snapshot of a Docker container at a specific point in time. Images are built using a Dockerfile, which is a text file that contains a set of instructions for building the image.
Docker images are stored in a registry, which is a centralized location for storing and managing Docker images. The most popular Docker registry is Docker Hub, which is a public registry that contains thousands of pre-built images that can be used as the basis for building new containers. For new learners, I would highly recommend browsing through Docker Hub.
When you run a Docker container (explained below), Docker uses the image as a template to create a new container instance.
Containers
The container is essentially a runtime environment that is isolated from the host system, allowing you to run applications and services in a predictable and reliable way. Docker containers are designed to be lightweight and portable, which makes them an ideal solution for deploying applications in a variety of environments, including development, testing, and production.
Containers are created from Docker images, which provide a consistent and reproducible way to package an application and all its dependencies. When a container is launched from an image, it runs in its own isolated environment with its own file system, network, and resources. This isolation ensures that the application runs consistently and reliably, regardless of the underlying host system.
To sum it up, containers are a way of packaging and running software applications in a lightweight and portable way, providing consistency and predictability across different environments.
In this blog, I have tried covering the prerequisite knowledge to work with Docker. We will be doing hands-on learning by downloading images, running containers and debugging containers, and will also learn a bit about the components of Docker, Docker files, and Volumes. In the subsequent blog which would be Docker for Dummies 3.0, we'll do Docker compose, learn a bit about private repositories (AWS ECR), and the best practices which revolve around Docker.
Some great video resources to start with-
Kunal Kushwaha-https://www.youtube.com/watch?v=17Bl31rlnRM
Techworld with Nana-https://www.youtube.com/watch?v=3c-iBn73dDE&t=24s
Train with Shubham-https://www.youtube.com/playlist?list=PLlfy9GnSVerRqYJgVYO0UiExj5byjrW8u
Signing off,
Cheers!