How to enable Docker Buildkit?

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:

version: '3.8'
    container_name: jenkins
    image: jenkins/jenkins
    user: root
    - 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


pipeline {
    agent any
    environment {
        DOCKER_BUILDKIT = '1'
        DOCKER_IMAGE = ''
        TAG = 'latest'
    stages {
        stage('Build') {
            steps {
                script {
          "${DOCKER_IMAGE}:${TAG}", "-f dockerfile-laravel .")

The following error message is on the log:

ERROR: BuildKit is enabled but the buildx component is missing or broken.
       Install the buildx component to build images with BuildKit:

How should I enable Docker Buildkit?


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

Welcome to this community @thematrixdev and thanks a lot for the feedback. :+1: