# How to enable Docker Buildkit?

**URL:** <https://community.jenkins.io/t/how-to-enable-docker-buildkit/11354>\
**Category:** Using Jenkins\
**Tags:** docker, pipeline\
**Created:** [December 19, 2023, 8:08am UTC](https://community.jenkins.io/t/how-to-enable-docker-buildkit/11354 "2023-12-19T08:08:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thematrixdev](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/thematrixdev/32/6454_2.png) [@thematrixdev](https://community.jenkins.io/u/thematrixdev)\
**Post date:** [December 19, 2023, 8:08am UTC](https://community.jenkins.io/t/how-to-enable-docker-buildkit/11354/1 "2023-12-19T08:08:40Z")

</div>

My project contains a Laravel project and a dockerfile.  
I would like to `docker build` and push the image to my private repository.  
Docker BuildKit support is needed.

Jenkins setup:

```auto
version: '3.8'
services:
  jenkins:
    container_name: jenkins
    image: jenkins/jenkins
    user: root
    volumes:
    - type: volume
      source: data
      target: /var/jenkins_home
    - type: bind
      source: /var/run/docker.sock
      target: /var/run/docker.sock
    - type: bind
      source: /usr/bin/docker
      target: /usr/bin/docker
    - type: bind
      source: ./known_hosts
      target: /root/.ssh/known_hosts
    privileged: true
    restart: unless-stopped

```

Jenkinsfile

```auto
pipeline {
    agent any
    environment {
        DOCKER_BUILDKIT = '1'
        DOCKER_IMAGE = 'myrepo.com/dummy'
        TAG = 'latest'
    }
    stages {
        stage('Build') {
            steps {
                script {
                    docker.build("${DOCKER_IMAGE}:${TAG}", "-f dockerfile-laravel .")
                }
            }
        }
    }
}

```

The following error message is on the log:

```auto
ERROR: BuildKit is enabled but the buildx component is missing or broken.
       Install the buildx component to build images with BuildKit:
       https://docs.docker.com/go/buildx/

```

How should I enable Docker Buildkit?

Thanks.

---

<div class="post-metadata">

**Author:** ![thematrixdev](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/thematrixdev/32/6454_2.png) [@thematrixdev](https://community.jenkins.io/u/thematrixdev)\
**Post date:** [December 19, 2023, 9:11am UTC](https://community.jenkins.io/t/how-to-enable-docker-buildkit/11354/2 "2023-12-19T09:11:43Z")

</div>

I have made Buildkit working by installing docker-buildx-plugin within the container.

---

<div class="post-metadata">

**Author:** ![poddingue](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/poddingue/32/985_2.png) [@poddingue](https://community.jenkins.io/u/poddingue)\
**Post date:** [December 19, 2023, 9:51am UTC](https://community.jenkins.io/t/how-to-enable-docker-buildkit/11354/3 "2023-12-19T09:51:22Z")

</div>

Welcome to this community @thematrixdev and thanks a lot for the feedback. 👍
