https://github.com/pratikshinde55/docker-in-docker-onaws
launch Docker Container and in this launched Container again install Docker and launch Docker Container in it. "Docker containers inside another Docker container".
https://github.com/pratikshinde55/docker-in-docker-onaws
docker-in-docker
Last synced: 3 months ago
JSON representation
launch Docker Container and in this launched Container again install Docker and launch Docker Container in it. "Docker containers inside another Docker container".
- Host: GitHub
- URL: https://github.com/pratikshinde55/docker-in-docker-onaws
- Owner: Pratikshinde55
- Created: 2024-02-13T12:21:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-24T13:26:15.000Z (8 months ago)
- Last Synced: 2025-01-13T16:50:34.292Z (4 months ago)
- Topics: docker-in-docker
- Homepage:
- Size: 39.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docker inside the Docker

### What is DOCKER IN DOCKER?(DinD)
Docker-in-Docker means we can run Docker containers inside another Docker container.In Docker world One process communicate with Other process is because od **"Unix Socket"**.
Command for go Location:
cd /run/containerd/
Command for list:
ls -i
### There are two ways to create Docker in Docker
1. Lauch Container by sharing Host Docker Socket
(-v /run/containerd/:/run/containerd/ )
2. Give all capabilities to the container (--privileged)
--privileged <> Give extended privileges to this container### What is Privileged capabilities:
When we create container have very limited power(not root power) or Capabilities,that not able to Launch 'New container in it',
but Running in **"--privileged"** mode to new container give All capabilities to Start Dockerin it .## Using 2nd method DinD (Give all capabilities to the container)
- Prerequisite: AWS account
### Step-1: [Install and Start docker service ] {DOCKER 1st}
Command for download Docker:yum install docker -y
Command for start Docker Service:
systemctl start docker
### Step-2: pull docker image (Docker provides a pre-created image for Docker inside Docker)
docker pull docker### Step-3: [lauch new Container by adding all Capabilities to the Container]
docker run -dit --privileged --name myDinD docker
### Step-4: [Attach new Container(myDinD) in that Container install Docker again] {DOCKER 2 inside DOCKER1}
docker exec -it myDinD sh
### Step-5: [Here Docker installed inside Container] (check in myDinD)
docker info
All docker command run in myDinD that is 'Docker inside Docker'
docker ps
docker images
docker pull docker
### Step-6: [We also launch Docker in Containerized Docker] {DOCKER 3 inside DOCKER 2}
Command for run Container with --privileged:docker run -dit --privileged --name myDinD2 docker
Command for attach or get shell terminal of running Container:
docker exec -it myDinD2 sh

### Step-7: [Here All DinD setup Done]
1.Docker host (Docker 1)2.myDinD container (Docker 2 inside Docker 1)
3.myDinD2 container (Docker 3 inside Docker 2)
