But I found inside the docker container, /usr/bin/docker is not available. I guess it was designed intentionally.

Yes, anyone with direct access to the Docker socket has root privileges on the host system. Usually not what you want.

If you’re running on Linux, you don’t have to directly install Docker in the container at all. You can bind mount the docker binary (usually at /usr/bin/docker) directly. Note that bind mounting the socket does not give you a totally new Docker, but rather access to the existing Docker daemon from inside the container. If you want to bake in the Docker binary to an image you could always make one called laoyumi/docker or something and then to “quickly” get access to it in another image you just start the Dockerfile with from laoyumi/docker.

There is Docker in Docker but it’s a little heavyweight if all you want to do is “some docker-ey stuff in containers that doesn’t need to be that isolated”.

When I was trying to build a docker image inside the container, I got following error:
root@fd8d47323d89:/Dockerimages/sample/2014-11-05 10:59:18.431193458 +0000 UTC# docker build .
2014/11/05 11:11:05 Cannot connect to the Docker daemon. Is ‘docker -d’ running on this host?

How can I let a docker client inside a docker container connects the docker daemon on the host os?