Whilst setting up docker on my local development machine the other day I encountered a permission problem. After installing docker I found that I had this permission problem that meant I couldn't run docker using my local user accounts. I was therefore forced to run docker as sudo, which I didn't want to do every time.
This is the error I was getting.
$ docker run hello-world docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied. See 'docker run --help'.
It turns out that docker have a section on their website dedicated to sorting out this issue. The steps involved in correcting this problem are as follows.