If you want to use Docker in Docker, that is nested Docker instances that are completely encapsulated from each other. You can do this with the DinD (Docker in Docker) tag of the docker image, as follows:
docker run --privileged -d docker:dind
The main trick is to have the --privileged flag. Then, there are a few things to care about:
cgroups pseudo-filesystems have to be mounted, and they have to be mounted with the same hierarchies than the parent environment; this is done by a wrapper script, which is setup to run by default;
/var/lib/docker cannot be on AUFS, so we make it a volume.
Note: --privileged is required for Docker-in-Docker to function properly, but it should be used with care as it provides full access to the host environment