title: Error when trying to build and run Docker container in TeamCity
body: <p>I want to build my Android Dockerfile and after this build step run some another step.</p>
  <p>The step is simple build the Docker image:
  <a href="https://i.stack.imgur.com/Satyo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Satyo.png" alt="enter image description here" /></a></p>
  <p>So the command is simple:</p>
  <pre><code>docker build -t android-build:android-template -f Dockerfile .
  </code></pre>
  <p>My Dockerfile is as below:</p>
  <pre><code>FROM openjdk:11.0.7
  
  ENV SDK_URL=&quot;https://dl.google.com/android/repository/commandlinetools-linux-6604631_latest.zip&quot; \
      ANDROID_HOME=&quot;/usr/local/android-sdk&quot; \
      ANDROID_VERSION=29 \
      ANDROID_BUILD_TOOLS_VERSION=28.0.3 \
  
  RUN mkdir &quot;$ANDROID_HOME&quot; .android \
      &amp;&amp; cd &quot;$ANDROID_HOME&quot; \
      &amp;&amp; curl -o sdk.zip $SDK_URL \
      &amp;&amp; unzip sdk.zip \
      &amp;&amp; rm sdk.zip
  
  RUN yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME --licenses
  
  RUN $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME --update
  
  RUN yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME \
      &quot;build-tools;${ANDROID_BUILD_TOOLS_VERSION}&quot; \
      &quot;platforms;android-${ANDROID_VERSION}&quot;
  
  RUN mkdir /application
  
  WORKDIR /application
  </code></pre>
  <p>Unfortunately, build is failing just on this first step:
  <a href="https://i.stack.imgur.com/F4hul.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F4hul.png" alt="enter image description here" /></a></p>
  <p>The whole error log is as below:</p>
  <pre><code> time=&quot;2020-07-18T22:01:27Z&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;
  00:01:27
    time=&quot;2020-07-18T22:01:27Z&quot; level=error msg=&quot;Can't add file /opt/buildagent/work/da45177e2c517d09/.git/index to tar: io: read/write on closed pipe&quot;
  00:01:27
    time=&quot;2020-07-18T22:01:27Z&quot; level=error msg=&quot;Can't close tar writer: io: read/write on closed pipe&quot;
  00:01:27
    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=fvz9t2pm9dkmopc06bf6yxqa5&amp;shmsize=0&amp;t=android-build%3Aandroid-template&amp;target=&amp;ulimits=null&amp;version=1: context canceled
  00:01:27
    Process exited with code 1
  00:01:28
    Process exited with code 1 (Step: Build a Docker container (Command Line))
  00:01:28
    Step Build a Docker container (Command Line) failed
  </code></pre>
  <p>I am running this docker-compose file:</p>
  <pre><code>version: &quot;3.1&quot;
  services:
    tcs:
      image: jetbrains/teamcity-server
      container_name: teamcity-server
      ports:
        - &quot;8111:8111&quot;
      volumes:
        - teamcity/server/data:/data/teamcity_server/datadir
        - teamcity/server/logs:/opt/teamcity/logs
    tca:
      image: jetbrains/teamcity-agent
      depends_on:
        - tcs
      container_name: teamcity-agent
      environment:
        - DOCKER_IN_DOCKER=start
        - SERVER_URL=http://tcs:8111/
      privileged: true
      volumes:
        - /teamcity/agent:/data/teamcity_agent/conf
  </code></pre>
  <p>on Mac: macOS Catalina Version 10.15.5</p>
  <p>I am not a DevOps guy, can you please help me with this?</p>