Launch Container Inside Docker Container

Aarati khamakar
3 min readApr 7, 2022

--

In this article I am going tell you about how to install docker inside docker .so let’s start…..

Requirement in Host machine

  • 1st we need to setup the docker in host machine. if you don’t have docker in host machine then read the following article

Steps for launching docker inside docker

  1. Launch one Image:

[root@localhost ARTH2.0]# docker run -it — name my container_1

— privileged centos

its show following output

2. Check update inside container

if show this error then use following commands , 1st go to the /etc/yum.repos.d/ directory

#sed -i ‘s/mirrorlist/#mirrorlist/g’ /etc/yum.repos.d/CentOS-*

#sed -i ‘s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g'
/etc/yum.repos.d/CentOS-*

Then use update command, it will show following output

3. use following commands to download the docker

#yum install -y yum-utils

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

# yum install docker-ce or # yum install docker-ce -y -y

after complete the update check the docker is available or not so for that use following command

#docker ps

it will show following output

3. start the docker inside container

#dockerd &

After that check docker avaialble or not

#docker ps

3. Pull the image inside container:

#docker pull “image name”

4. Launch container inside container

finally we launched the docker inside docker

#exit command is used for to come out of the launched image

Thank You !! for reading the article………….

--

--