I am trying to run Python CGI script inside which I need to run docker image.
I am using Docker version 1.6.2. user is "www-data", which is added in docker group.
www-data : www-data sudo docker
www-data@mytest:~/html/new$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fatal msg="Get http:///var/run/docker.sock/v1.18/images/json: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?"
Permission denied on a default install indicates you are trying to access the socket from a user other than root or that is not in the docker group. You should be able to run:
sudo usermod -a -G docker $username
on your desired $username to add them to the group. You'll need to logout and back in for this to take effect (or restart the service).
Note that doing this effectively gives that user full root access on your host, so do this with care.