aboutsummaryrefslogtreecommitdiff
path: root/kolla/common
diff options
context:
space:
mode:
authorMichal Nasiadka <mnasiadka@gmail.com>2026-06-11 21:47:52 +0100
committerMichal Nasiadka <mnasiadka@gmail.com>2026-06-18 08:54:32 +0000
commit4e66cc2f5982cdab26e3838411a37ea115fd7ef5 (patch)
treec1df2f352c8a5779ed29ee0f429c8ef7142fe302 /kolla/common
parent4e85395936cf17d6912b68fc51ca6c18e90156f7 (diff)
downloadkolla-4e66cc2f5982cdab26e3838411a37ea115fd7ef5.tar.gz
kolla-4e66cc2f5982cdab26e3838411a37ea115fd7ef5.zip
kolla-build: Add Docker BuildKit support via docker buildx build
Add --buildkit flag to use docker buildx build instead of the docker-py SDK. An optional --buildkit-builder selects a named buildx builder instance, enabling docker-container or remote drivers for multi-arch builds. --buildkit and --squash are mutually exclusive and rejected at startup. PushTask is skipped when buildkit is active; push is handled inline. Set buildkit as the new default. Change-Id: Idbf1d1bdc091bb84721f8006c2b916731b999859 Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
Diffstat (limited to 'kolla/common')
-rw-r--r--kolla/common/config.py8
-rw-r--r--kolla/common/utils.py15
2 files changed, 23 insertions, 0 deletions
diff --git a/kolla/common/config.py b/kolla/common/config.py
index c4ebcbf3b..b418552f4 100644
--- a/kolla/common/config.py
+++ b/kolla/common/config.py
@@ -171,6 +171,14 @@ _CLI_OPTS = [
help='The Docker namespace name'),
cfg.StrOpt('network_mode', default='host',
help='The network mode for Docker build. Example: host'),
+ cfg.BoolOpt('buildkit', default=True,
+ help='Use Docker BuildKit (docker buildx build) when building '
+ 'images. Requires the docker-buildx-plugin to be '
+ 'installed. Only valid with --engine docker.'),
+ cfg.StrOpt('buildkit-builder', default=None,
+ help='Name of the docker buildx builder instance to use. '
+ 'If unset the currently active builder is used. '
+ 'Only valid with --buildkit.'),
cfg.BoolOpt('cache', default=True,
help='Use the container engine cache when building'),
cfg.StrOpt('patches-path', default=None,
diff --git a/kolla/common/utils.py b/kolla/common/utils.py
index 4ee80768f..485848ba2 100644
--- a/kolla/common/utils.py
+++ b/kolla/common/utils.py
@@ -54,6 +54,21 @@ def make_a_logger(conf=None, image_name=None):
LOG = make_a_logger()
+def check_docker_buildx():
+ try:
+ subprocess.check_output( # nosec
+ ['docker', 'buildx', 'version'], stderr=subprocess.STDOUT)
+ except OSError as ex:
+ if ex.errno == 2:
+ LOG.error('"docker" command is not found.')
+ raise
+ except subprocess.CalledProcessError:
+ LOG.error('"docker buildx" is not available. '
+ 'Install the docker-buildx-plugin or disable BuildKit '
+ 'with "--nobuildkit".')
+ raise
+
+
def get_docker_squash_version():
try: