Running Docker from within Docker
At times, we may want to run a container hosting an application that automates certain Docker tasks. How can we do that? Docker Engine and the Docker CLI are installed on the host, yet the application runs inside the container. Well, from early on, Docker has provided a means to bind-mount Linux sockets from the host into the container. On Linux, sockets are used as very efficient data communications endpoints between processes that run on the same host. The Docker CLI uses a socket to communicate with Docker Engine; it is often called the Docker socket. If we can give access to the Docker socket to an application running inside a container, then we can just install the Docker CLI inside this container, and we will then be able to run an application in the same container that uses this locally installed Docker CLI to automate container-specific tasks.
Important note
Here, we are not talking about running Docker Engine inside the container but...