dockINdock

To Install & run docker inside docker??

Sonam Kumari Singh
3 min readNov 7, 2021

--

Docker :-

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.

See Docker-in-Docker

It is used to launch new os with less boot time 2–3 sec only. It will launch centos latest version . The basic docker run command takes this form:

[root@localhost ~]# docker run –it –-name abhi centos:latest
1

“privileged” mode — U can now run docker within docker itself, As we know that the privileged mode allows access to access to all devices connected to the host as similar to the host using those devices or resources. It actually allows the container to have almost the same access to the host as a process running outside containers on the host.

[root@localhost ~]# docker run –it –name abhi1 –privileged indocker:v1
2

And then next, install using & set-up repository

Install the yum-utils package (which provides the yum-config-manager utility) and set up the stable repository.

[root@8d71a48616eb /]# yum install –y yum-utilsyum-config-manager \--add-repo \https://download.docker.com/linux/centos/docker-ce.repo
3
4

Set-up repos file ( yum-config-manager \ ) in this time given error in this type then use this command :

[root@8d71a48616eb /]# dnf install langpacks-en glibc-all-langpacks -y

And then add repo file : yum-config-manager \

--add-repo \https://download.docker.com/linux/centos/docker-ce.repo
5

So, Install Docker

6

Let’s check Docker is working or Not ?

with Docker installed, does not run its own docker daemon, but connects to the Docker daemon of the host system.

7
8

What is /var/run/docker.sock ?

It is the default Unix socket. Sockets are meant for communication between processes on the same host. Docker daemon by default listens to docker.sock.

If you are on the same host where docker daemon is running, you can use the /var/run/docker.sock to manage containers.

“ dockerd “ - is the persistent process that manages containers. Docker uses different binaries for the daemon and client. To run the daemon u type “dockerd”.

9

The docker run command can be used in combination with docker commit to change the command that a container runs.

To run the daemon with debug output, then use this command :

[root@8d71a48616eb /]# dockerd &
10

And then inside the Docker container that you just started, run some Docker commands, for example:

[root@8d71a48616eb /]# docker info

11

[root@8d71a48616eb /]# docker ps

12

Thank You !

--

--

Sonam Kumari Singh

SONAM here! Grateful for your connection! Tech enthusiast exploring new languages, deep into DevOps, with a spotlight on Linux. 😊🚀