docker buildkit not supported by daemon in AWS EKS kubernetes cluster

9/9/2019

I am using Build Toolkit to build docker image for each microservice.

./build.sh

export DOCKER_BUILDKIT=1
# ....
docker build -t ....
# ... 

This works on my machine with docker (18.09.2).

However, it does not work with Jenkins, that I setup as following :

  • EKS is provisioned with a Terraform module

    module "eks" {
      source   = "terraform-aws-modules/eks/aws"
      version  = "5.0.0"
      # ....
    }
    
  • Jenkins is deployed on EKS (v1.12.10-eks-ffbd9 , docker://18.6.1) via this Helm Chart.

  • Jenkins plugins as defined in Values of the helm release:

    • kubernetes:1.18.1
    • workflow-job:2.33
    • workflow-aggregator:2.6
    • credentials-binding:1.19
    • git:3.11.0
    • blueocean:1.19.0
    • bitbucket-oauth:0.9
  • Jenkins Pipeline is declarative, and it uses a Pod template where the container image is docker:18-dind and the container name is dind.

  • This is my Jenkinsfile

    pipeline {
      agent {
        kubernetes {
          defaultContainer 'jnlp'
          yamlFile 'jenkins-pod.yaml'
        }
      }
      stages {
        stage('Build Backends') {
          steps {
            container('dind') {
              sh 'chmod +x *sh'
              sh './build.sh -t=dev'
            }
            containerLog 'dind'
          }
        }
      }
    

    }

When Jenkins executes this pipeline, it shows this error :

buildkit not supported by daemon

I am not sure which software should I upgrade to make docker-buildkit work ? and to which version ?

  • Terraform eks Module which is now 5.0.0 ?

Or

  • docker:18-dind image which behaves like environment of the ephemeral Jenkins slaves ?

Or

  • the Jenkins Plugin kubernetes:1.18.1 ?
-- Abdennour TOUMI
docker
docker-buildkit
jenkins
kubernetes
terraform

2 Answers

9/9/2019

Docker buildkit support came out of experimental in 18.09, so you may need to upgrade docker inside of EKS:

EKS (v1.12.10-eks-ffbd9 , docker://18.6.1

Or perhaps you have an old dind image (the 18-dind should be new enough, but an older version of this tag pointing to 18.06 or 18.03 would not). You can try 18.09-dind and 19-dind which should both work if the build is actually happening inside dind.

-- BMitch
Source: StackOverflow

9/9/2019

According to docker-ce sources for starting buildkit session, there are two requirements to make success check isSessionSupported:

  • dockerCli.ServerInfo().HasExperimental
  • versions.GreaterThanOrEqualTo(dockerCli.Client().ClientVersion(), "1.31"

So, check version of your docker-cli library and if it HasExperimental option enabled.

To check if it has Experimantal support, you can run from shell:

docker version -f '{{.Server.Experimental}}'

-- Yasen
Source: StackOverflow