Unleashing the Dockerception: Launching Containers within Containers with Docker!

What is Containerization ?

Pramod Kumar Gupta
4 min readJul 31, 2023

--

Containerization is a technology and methodology used in software development and deployment to package an application along with all its dependencies, libraries, and configuration files into a single unit called a container. Containers are lightweight, isolated, and portable, enabling applications to run consistently and reliably across different computing environments, such as development machines, testing servers, and production systems.

Docker is an open-source platform that enables developers to automate the deployment, scaling, and management of applications inside lightweight, portable containers. Containers are a form of virtualization technology that allows applications and their dependencies to be isolated from the underlying system and run consistently across different environments.

What is docker ?

The main components of Docker are:

1. Docker Engine: This is the core component of Docker that allows you to create, run, and manage containers. It consists of a server and a REST API, which lets users interact with Docker.

2. Docker Images: An image is a lightweight, standalone, and executable package that includes everything needed to run an application, including the code, runtime, libraries, dependencies, and system tools.

3. Docker Container: A container is an instance of a Docker image. It encapsulates the application and its environment, ensuring that it runs consistently on any platform that supports Docker.

The key advantages of using Docker include:

1. Portability: Docker containers can run on any system that supports Docker, making it easier to move applications between development, testing, and production environments.

2. Isolation: Containers isolate applications from the underlying system, reducing the chance of conflicts between dependencies and making applications more secure.

3. Efficiency: Containers share the host system’s OS kernel, making them lightweight and faster to start compared to traditional virtual machines.

4. Scalability: Docker makes it simple to scale applications by quickly deploying additional containers to handle increased loads.

5. Version control: Docker images are versioned, allowing developers to track changes and roll back to previous versions if needed.

Docker has revolutionized software development and deployment practices, as it enables developers to package applications with their dependencies into containers, ensuring consistency and reproducibility across different environments. This technology has become an essential part of modern software development workflows, DevOps practices, and cloud-native application architectures.

In this article, I will utilize Amazon Linux as the foundation for installing Docker Engine and proceeding with the rest of the practical tasks.

First install docker using follwoing coomand .

yum install docker -y

Then launch a conatiner using the following command .

docker run --privileged -it --name did centos:7

Once the container has been launched, proceed to set up the yum repository inside the container and subsequently install docker-ce.

yum install -y yum-utils

yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

yum install docker-ce -y

The installation process may take some time, but eventually, the Docker Community Edition software will be successfully installed in the container.

To initiate the Docker Engine, you can use the following command:

dockerd &

Docker service is started .

Now lets again run a conatiner inside the and install docker in that conatiner . Repeat the above steps .

docker run --privileged -it --name did centos:7

Now install docker in this container .

And start the service .

Now docker is started .

We have successfull Configured Docker inside Docker inside Docker .

Thanks for reading ….

--

--