3

I have a registered gitlab-runner with a docker executor. When it runs this .gitlab-ci.yml:

image: docker:latest

variables:
  DOCKER_BUILDKIT: "1" 

build:
  stage: build
  script:
    # There are additional flags cut out requiring BuildKit.
    - docker build . 

and /var/run/docker.sock mounted, it fails with:

ERROR: docker.io/docker/dockerfile:experimental not found
------
 > resolve image config for docker.io/docker/dockerfile:experimental:
------
failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: docker.io/docker/dockerfile:experimental not found

When I include

services:
  - docker:dind

to .gitlab-ci.yml and remove the /var/run/docker.sock mount (so changing the daemon used to being the child container's instead of the host's), it succeeds.

Here is the Dockerfile:

# syntax=docker/dockerfile:experimental
...

Is there an incompatibility with BuildKit / experiment syntax and using the host's docker socket? I have it working with the child container using its own socket through dind, but I want to have this succeed with the socket mounted instead.

David Maze
  • 130,717
  • 29
  • 175
  • 215
Mario Ishac
  • 5,060
  • 3
  • 21
  • 52

1 Answers1

0

I was able to get this working by following the solution at BuildKit mode fails to fetch the frontend image when registry-mirrors is specified. Thing is there were no registry mirrors for my gitlab-runner, but doing the following before the job executed did the trick:

docker pull docker/dockerfile:experimental 

# Replace with whatever image `Dockerfile` is based on.
docker pull ubuntu:latest 

Still in the dark as to why this issue relates to the registry-mirrors one and is fixed by the same thing, but for now this does the job.

Mario Ishac
  • 5,060
  • 3
  • 21
  • 52