I run a ubuntu container inside docker by command docker run - it ubuntu bash . . .

rohit singh:
I run a ubuntu container inside docker by command
docker run - it ubuntu bash
And this c9mmand open a bash terminal
But when i try to execute docker command init it shows docker command not found .
Why it is so ?
How can i run docker command inside a docker container?
@Mihai Pruna

Nihal Satbhai:
You need to install docker manually in your ubuntu image or You can write a dockerfile which will do this job using base image as Ubuntu

rohit singh:
Installing docker manually inside may use extra storage space of my physical drive ?

Carles Terol:
Not sure but… what about try “sudo docker”?

Matthew Robinson:
The more fundamental question is “Why do you need docker inside the container?” Docker in docker is only required in some very specific use cases.

rohit singh:
sir i am using docker in wsl2(ubuntu) and try to creat a docker image inside a docker container to run a web application and i am using docker inside docker to tackle with storage usages problem of my remote device . once @Matthew Robinson

rohit singh:
Is that not the good practice

Matthew Robinson:
If you just want to run a web application in a container you should build the image and run the container using Docker on your host system.

Matthew Robinson:
You shouldn’t need to start a docker container and then run docker in that container to start your web app container

Matthew Robinson:
Your web application image should contain the minimum required to run your web application.

Matthew Robinson:
And you don’t need docker inside the web application image to run the web app.

Matthew Robinson:
In fact having Docker inside the image would be a potential security risk

Matthew Robinson:
From your screenshot it looks like you can successfully launch the Ubuntu image. So Docker is correctly installed on your host (WSL2).

If you want. to list the running containers docker ps you should do this from a different terminal window

rohit singh:
Got it thank u so much