Build job seems to be broken for Auto DevOps

We are using Auto DevOps for some Go applications. Today pipelines suddenly stopped working with the following error:

$ /build/build.sh
Logging in to GitLab Container Registry with CI credentials...
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
Building Dockerfile-based application...
Attempting to pull a previously built image for use with --cache-from...
Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?
Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?
No previously cached image found. The docker build will proceed without using a cached image
Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?
Cleaning up file based variables
00:00
ERROR: Job failed: command terminated with exit code 1

As we do not have a .gitlab-ci.yaml file (we use Auto DevOps), we checked whether there were any recent changes on the job pipelines that Auto DevOps uses. We have seen the Build job has seen its image updated from auto-build-image:v0.6.0 to auto-build-image:v0.4.0.

Our current plan is to stop using Auto DevOps and simply include older versions of the Build job. But, it would be nice to see this issue solved.

Feel free to ask for any other information that might help you pinpoint the cause for this issue.

Cause

The new Docker version included a deprecation notice for implicitly disabled TLS, and added a delay before listening on the non-TLS port. Builds fail on runners without an explicitly configured DOCKER_TLS_CERTDIR volume (such as ones installed in Kubernetes via GitLab UI), if the non-TLS listener has not yet started (which is almost always the case).

Workaround

Add a .gitlab-ci.yml overriding build job with the fix. There are two options given, pick one:

# SKIP this if you already include it, or if you include Jobs/Build.gitlab-ci.yml in your .gitlab-ci.yml
include:
  - template: Auto-DevOps.gitlab-ci.yml

# OPTION 1: keep the new auto-build-image, override the services to fix communication with docker:dind
build:
  services:
    - name: "docker:20.10.6-dind"
      command: ['--tls=false', '--host=tcp://0.0.0.0:2375']

# OPTION 2: fully revert to the previous version of auto-build-image and docker:dind
build: 
  image: "registry.gitlab.com/gitlab-org/cluster-integration/auto-build-image:v0.4.0"
  services:
    - docker:docker:19.03.12-dind
Edited by Hordur Freyr Yngvason