title: Can not find `/var/run/docker.sock` in docker container after `docker run -id -v /var/run/docker.sock:/var/run/docker.sock {xxx} /usr/sbin/init`
body: <p>I want to use docker command in a docker container, to build docker images. So I found a solution from <a href="http://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/" rel="nofollow noreferrer">here</a>. I followed the instruction and I succeeded to build docker images in running container.
  I start the container as follows:</p>
  <pre><code>docker run --privileged=true -id -host -v /var/run/docker.sock:/var/run/docker.sock {image_name}`
  </code></pre>
  <p>And then I can use <code>docker exec -it {container_id} /bin/bash</code> to get into the container and run <code>docker build</code> in the container.</p>
  <p>But if I start the container as follows:</p>
  <pre><code>docker run --privileged=true -id -host -v /var/run/docker.sock:/var/run/docker.sock {image_name} /usr/sbin/init
  </code></pre>
  <p>I can not use docker command in the container any more.
  Here, I use <code>/usr/sbin/init</code> to start <code>ssh</code> server int the container. I check the container and I find that <code>/var/run/docker.sock</code> is not found in the container. This is why the docker command in the container can not work.</p>
  <p>But I don't know why <code>/var/run/docker.sock</code> is not found in the container with <code>/usr/sbin/init</code> and how I can solve it.</p>
  <p>Anybody help? Thank you.</p>