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'
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
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:
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.