<p>I'm attempting to build a branch using Jenkins and a 'docker in the docker' container to build a container from src.</p>
<p>I define the Docker cloud instance here:</p>
<p><a href="https://i.stack.imgur.com/oTSjY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oTSjY.png" alt="enter image description here" /></a></p>
<p>Should an extra tab be available that enable the job to use the Docker cloud instance setup above?</p>
<p>The job is a multi-branch pipeline:</p>
<p><a href="https://i.stack.imgur.com/JdfTV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JdfTV.png" alt="enter image description here" /></a></p>
<p>But when I attempt to configure a job that uses the docker cloud instance, configured above, the option to build with docker is not available:</p>
<p><a href="https://i.stack.imgur.com/WXfSP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WXfSP.png" alt="enter image description here" /></a></p>
<p>The build log contains:</p>
<blockquote>
<p>time=&quot;2021-04-04T14:27:16Z&quot; level=error msg=&quot;failed to dial gRPC:
cannot connect to the Docker daemon. Is 'docker daemon' running on
this host?: dial unix /var/run/docker.sock: connect: no such file or
directory&quot; error during connect: Post
http://%2Fvar%2Frun%2Fdocker.sock/v1.40/build?buildargs=%7B%7D&amp;cachefrom=%5B%5D&amp;cgroupparent=&amp;cpuperiod=0&amp;cpuquota=0&amp;cpusetcpus=&amp;cpusetmems=&amp;cpushares=0&amp;dockerfile=Dockerfile&amp;labels=%7B%7D&amp;memory=0&amp;memswap=0&amp;networkmode=default&amp;rm=1&amp;session=vgpahcarinxfh05klhxyk02gg&amp;shmsize=0&amp;t=ron%2Fml-services&amp;target=&amp;ulimits=null&amp;version=1:
context canceled [Pipeline] } [Pipeline] // stage [Pipeline] }
[Pipeline] // node [Pipeline] End of Pipeline [Bitbucket] Notifying
commit build result [Bitbucket] Build result notified ERROR: script
returned exit code 1 Finished: FAILURE</p>
</blockquote>
<p>which suggests the build is searching for Docker on the same host as Jenkins, but I'm attempting to build with Docker on a different host?</p>
<p>Have I configured Docker with Jenkins correctly?</p>
<p>My <code>Jenkinsfile</code> contains:</p>
<pre><code>node {
      def app
      stage('Clone repository') {
            checkout scm
      }
      stage('Build image') {
            app = docker.build(&quot;ron/services&quot;)
       }
       stage('Push image') {
      docker.withRegistry('https://registry.hub.docker.com', 'git') {
       app.push(&quot;${env.BUILD_NUMBER}&quot;)
       app.push(&quot;latest&quot;)
              }
           }
        }
</code></pre>
<p>Update:</p>
<p>Clicking the checkmark at <code>Expose DOCKER_HOST</code> , rebuilding contains error:</p>
<pre><code>+ docker build -t ron/services .
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
ERROR: script returned exit code 1
Finished: FAILURE
</code></pre>

blue-sky
<p>The docker cli tries to connect using the docker socket in <code>/var/run</code>. This means that no external daemon is configured, for example using the environment variable <code>DOCKER_HOST</code>.
Try clicking the checkmark at <code>Expose DOCKER_HOST</code>.</p>
