How to do dind (docker-in-docker)

There seems to be dind images on DockerHub, but I’m not sure how to use it.

When I tried to use it, I got an error like:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Also I tried machine mode, but I got an error as well:

Build-agent version 1.0.15283-35354d0e (2019-09-09T12:09:35+0000)
Creating a dedicated VM with circleci/buildpack-deps:latest-dind image
failed to create host: Image circleci/buildpack-deps:latest-dind is not supported

So… how to dind? Could you please tell me?

Solved, using docker mode and -dind based image.