Cannot create template, docker socket permission denied

Hi all, I am trying to create a template using the coder template create command on a template I had previously installed. However this time it complains that
Error: Error pinging Docker server: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied
Error: Error pinging Docker server: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied
during the Detecting persistent resources step. The files are unchanged to when it used to work, the only thing that changed is that I had to re-install my docker server instance which probably bumped it's version. My template does use docker swarm terraform resources to create the workspaces in the cluster. However neither does coder template create work on the cluster's host machine nor from an external machine. I tried it on both windows and linux, sudo and non-sudo, same result every time. Any ideas? Thanks!
3 Replies
maanex
maanexOP2y ago
(Please @ me when replying, thanks)
maanex
maanexOP2y ago
Oh my bad. I found what you linked while searching but didn't think it would apply since I 1) already did this and 2) the issue was occurring outside of the container. Found out that for some reason the docker.sock hat the wrong permissions set. chmod fixed it. Thanks!

Did you find this page helpful?