I need to run docker commands from jenkins which is installed as a container on docker. My local setup is on an OSX and I use boot2docker to virtualize the docker machine.>
As @ISanych suggests you can simply do -v /var/run/docker.sock:/var/run/docker.sock and it will also magically work on boot2docker. No need to define DOCKER_URL.
You might also find --net=host useful if need to access the ports of the started containers.