diff --git a/python_on_whales/components/buildx/cli_wrapper.py b/python_on_whales/components/buildx/cli_wrapper.py index 3877407c..fef170a5 100644 --- a/python_on_whales/components/buildx/cli_wrapper.py +++ b/python_on_whales/components/buildx/cli_wrapper.py @@ -367,7 +367,8 @@ def build( full_cmd.add_simple_arg("--cache-to", format_dict_for_buildx(cache_to)) else: full_cmd.add_simple_arg("--cache-to", cache_to) - full_cmd.add_args_iterable_or_single("--secret", to_list(secrets)) + if secrets: + full_cmd.add_args_iterable_or_single("--secret", to_list(secrets)) if output != {}: full_cmd += ["--output", format_dict_for_buildx(output)] if platforms is not None: