title: Error while build image via gitlab cd/cd - Error while fetching server API version
body: <p>Operation system CentOS Linux release 8.3.2011 x86_64</p>
  <p>I try build image when push to master, this is my simple ci/cd config file .gitlab-ci.yml</p>
  <pre><code>image:
    name: docker/compose:alpine-1.29.2
    entrypoint: [&quot;&quot;]
  
  stages:
    - build
  
  build-job:
    stage: build
    script:
      - echo $(whoami)
      - docker -v
      - docker-compose --version
      - docker-compose build --no-cache
      - docker-compose push
      - echo &quot;Compile complete.&quot;
    only:
      - master
  </code></pre>
  <p>While pipeline running, i have next error</p>
  <pre><code>$ echo $(whoami)
  root
  $ docker -v
  Docker version 19.03.15, build 99e3ed8
  $ docker-compose --version
  docker-compose version 1.29.2, build 5becea4
  $ docker-compose build --no-cache
  [21] Failed to execute script docker-compose
  Traceback (most recent call last):
    File &quot;urllib3/connectionpool.py&quot;, line 677, in urlopen
    File &quot;urllib3/connectionpool.py&quot;, line 392, in _make_request
    File &quot;http/client.py&quot;, line 1277, in request
    File &quot;http/client.py&quot;, line 1323, in _send_request
    File &quot;http/client.py&quot;, line 1272, in endheaders
    File &quot;http/client.py&quot;, line 1032, in _send_output
    File &quot;http/client.py&quot;, line 972, in send
    File &quot;docker/transport/unixconn.py&quot;, line 43, in connect
  ...
  During handling of the above exception, another exception occurred:
  Traceback (most recent call last):
    File &quot;docker-compose&quot;, line 3, in &lt;module&gt;
    File &quot;compose/cli/main.py&quot;, line 81, in main
    File &quot;compose/cli/main.py&quot;, line 200, in perform_command
    File &quot;compose/cli/command.py&quot;, line 70, in project_from_options
    File &quot;compose/cli/command.py&quot;, line 153, in get_project
    File &quot;compose/cli/docker_client.py&quot;, line 43, in get_client
    File &quot;compose/cli/docker_client.py&quot;, line 170, in docker_client
    File &quot;docker/api/client.py&quot;, line 197, in __init__
    File &quot;docker/api/client.py&quot;, line 222, in _retrieve_server_version
  docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
  </code></pre>
  <p>I checked permission on sock files</p>
  <pre><code>ls -la /var/run/docker.sock
  srw-rw-rw- 1 root docker 0 Feb  1 10:05 /var/run/docker.sock
  ls -la /run/containerd/containerd.sock
  srw-rw-rw- 1 root root 0 Feb  1 10:05 /run/containerd/containerd.sock
  </code></pre>
  <p>Docker service is running on host machine</p>
  <pre><code>systemctl status docker
  ● docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
     Active: active (running) since Tue 2022-02-01 10:05:10 MSK; 27min ago
       Docs: https://docs.docker.com
   Main PID: 10698 (dockerd)
      Tasks: 10
     Memory: 430.4M
     CGroup: /system.slice/docker.service
             └─10698 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
  ...
  </code></pre>
  <p>Have anybody ideas?</p>