Jenkins: Can't connect to Docker daemon
<p>I am running Jenkins and Docker on a CentOS machine. I have a Jenkins job that pulls a Github repo and builds a Docker image. When I try running the job I get the error:</p>
<pre><code>+ docker build -t myProject .
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
Build step 'Execute shell' marked build as failure
Finished: FAILURE
</code></pre>
<p>This problem occurs even though I have added jenkins to my docker usergroup via <code>sudo usermod -aG docker jenkins</code> and restarted my machine. How do I fix this?</p>
<p>By the way, if try changing the command to <code>sudo docker build -t myProject .</code> I just get the error <code>sudo: sorry, you must have a tty to run sudo</code></p>