docker run -v /var/run/docker.sock:/var/run/docker.sock -ti docker
#Inside Container
docker pull ubuntu
#When you list the docker images, you should see the ubuntu image along with other docker images in your host VM
docker images
# Now create a Dockerfile inside test directory
and RUN DOCKER FILE
docker build -t test-image .
方法 2:使用 dind 在 Docker 中运行 Docker
注意:这要求您的容器在特权模式下运行。
docker run --privileged -d --name dind-test docker:dind
docker exec -it dind-test /bin/sh
docker pull ubuntu
docker images
mkdir test && cd test
vi Dockerfile
#Create Docker file and then run
docker build -t test-image
git clone --recursive git@github.com:nestybox/sysbox.git
make sysbox
sudo make install
#Once Sysbox is installed, you start it with:
sudo ./scr/sysbox
#Configuring Docker
sudo ./scr/docker-cfg --sysbox-runtime=enable