* [PATCH 1/2] scripts: add --registry option to container tool
@ 2026-10-11 20:54 Guillaume Tucker
2026-10-11 20:54 ` [PATCH 2/2] Documentation: dev-tools: cover registry option in container.rst Guillaume Tucker
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Guillaume Tucker @ 2026-10-11 20:54 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier, Jonathan Corbet, Miguel Ojeda
Cc: Guillaume Tucker, Onur Özkan, linux-doc, workflows,
linux-kbuild, linux-kernel
Add a --registry / -R command line argument to the container tool to
specify an altnerative image registry and support it in the TOML
configuration file accordingly.
This uses a mechanism based on regular expressions to parse the
container registry and image names and construct the final one based
on a set of priority rules. A registry can be included directly in an
image name; an empty string means a local image. It can then be
overridden by explicitly specifying a registry name via the CLI option
or the TOML file, with the CLI option taking precedence as always.
Signed-off-by: Guillaume Tucker <gtucker@gtucker.io>
---
scripts/container | 126 ++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 117 insertions(+), 9 deletions(-)
diff --git a/scripts/container b/scripts/container
index a3a55180d6ed..de72725656a8 100755
--- a/scripts/container
+++ b/scripts/container
@@ -10,6 +10,7 @@ import dataclasses
import logging
import os
import pathlib
+import re
import shutil
import subprocess
import sys
@@ -17,6 +18,89 @@ import tomllib
import uuid
+def _init_registry_regex():
+ domain = r'[{anum}][{anum}-]*\.[{anum}\.-]*[{anum}]'.format(anum=r'a-z0-9')
+ ipv6 = r'\[[a-fA-F0-9\:]+\]'
+ port = r'[\d]{1,5}'
+ return rf'((?P<domain>{domain})|(?P<ipv6>{ipv6}))(\:(?P<port>{port}))?'
+
+
+def _init_image_regex():
+ step = r'([{anum}]|[{anum}][a-z0-9_\.\-]*[{anum}])'.format(anum=r'a-z0-9')
+ tag = r'[a-zA-Z0-9_][a-zA-Z0-9_\.\-\/]{0,127}'
+ return rf'(?P<path>{step}(\/{step})*)(\:(?P<tag>{tag}))?'
+
+
+REGISTRY_REGEX = _init_registry_regex()
+IMAGE_REGEX = _init_image_regex()
+
+
+class ImageParserMixin:
+ """Helper mixin to parse container image names"""
+
+ @classmethod
+ def from_fields(cls, fields):
+ """Get an object using a valid subset of fields or None"""
+ kwargs = {}
+ for field in dataclasses.fields(cls):
+ if value := fields.get(field.name):
+ kwargs[field.name] = value
+ return cls(**kwargs) if kwargs else None
+
+ @classmethod
+ def from_name(cls, name):
+ """Get an object using fields in the name matching ._regex or None"""
+ re_match = cls._regex.match(name)
+ return cls.from_fields(re_match.groupdict()) if re_match else None
+
+
+@dataclasses.dataclass
+class RegistryName(ImageParserMixin):
+ """Parsed container registry name with no image"""
+ registry: str = None
+ domain: str = None
+ ipv6: str = None
+ port: str = None
+ _regex = re.compile(rf'^(?P<registry>{REGISTRY_REGEX})$')
+
+
+@dataclasses.dataclass
+class ImageName(ImageParserMixin):
+ """Parsed container image name with no registry"""
+ image: str = None
+ path: str = None
+ tag: str = None
+ _regex = re.compile(rf'^(?P<image>{IMAGE_REGEX})$')
+
+
+@dataclasses.dataclass
+class FullImageName(ImageParserMixin):
+ """Parsed image name including an optional registry"""
+ image: ImageName
+ registry: RegistryName = None
+ _regex = re.compile(
+ rf'^((?P<registry>{REGISTRY_REGEX})\/)?(?P<image>{IMAGE_REGEX})?$'
+ )
+
+ @property
+ def name(self):
+ """Full name in registry/image:tag format with optional registry"""
+ return (
+ '/'.join((self.registry.registry, self.image.image))
+ if self.registry else self.image.image
+ )
+
+ @classmethod
+ def from_name(cls, name):
+ if re_match := cls._regex.match(name):
+ fields = re_match.groupdict()
+ return FullImageName(
+ registry=RegistryName.from_fields(fields),
+ image=ImageName.from_fields(fields),
+ )
+ return None
+
+
class ContainerRuntime(abc.ABC):
"""Base class for a container runtime implementation"""
@@ -145,6 +229,7 @@ class Config:
"""Container configuration"""
image: str = None
runtime: str = None
+ registry: str = None
env_file: str = None
uid: int = None
gid: int = None
@@ -188,23 +273,40 @@ def _get_logger(verbose):
return logger
+def _get_image(args, config):
+ image_name = args.image or config.image
+ if not image_name:
+ raise ValueError("no image specified")
+ image = FullImageName.from_name(image_name)
+ if image is None:
+ raise ValueError(f"invalid image name: {image_name}")
+ if args.registry == '':
+ image.registry = None
+ elif args.registry is not None:
+ image.registry = RegistryName.from_name(args.registry)
+ if image.registry is None:
+ raise ValueError(f"invalid registry name: {args.registry}")
+ elif config.registry is not None and image.registry is None:
+ image.registry = RegistryName.from_name(config.registry)
+ if image.registry is None:
+ raise ValueError(f"invalid registry name: {config.registry}")
+ return image
+
+
def main(args):
"""Main entry point for the container tool"""
logger = _get_logger(args.verbose)
try:
config = Config.from_toml(args.config_file, args.config_profile)
- runtime = args.runtime or config.runtime
- cls = Runtimes.get(runtime) if runtime else Runtimes.find()
+ runtime_name = args.runtime or config.runtime
+ cls = Runtimes.get(runtime_name) if runtime_name else Runtimes.find()
+ logger.debug("runtime: %s", cls.name)
+ image = _get_image(args, config)
+ logger.debug("image: %s", image.name)
except ValueError as ex:
logger.error(ex)
return 1
- logger.debug("runtime: %s", cls.name)
- image = args.image or config.image
- if not image:
- logger.error("no image specified")
- return 1
- logger.debug("image: %s", image)
- return cls(args, config, logger).run(image, args.cmd)
+ return cls(args, config, logger).run(image.name, args.cmd)
if __name__ == '__main__':
@@ -235,6 +337,12 @@ if __name__ == '__main__':
help="Profile section to use in the config file. This will override "
"any values defined in the DEFAULT section."
)
+ parser.add_argument(
+ '-R', '--registry', nargs='?', const='',
+ help="Container registry name. Any registry already included in the "
+ "image name will be replaced or removed when using this option with "
+ "no value."
+ )
parser.add_argument(
'-r', '--runtime', choices=Runtimes.get_names(),
help="Container runtime name. If not specified, the first one found "
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] Documentation: dev-tools: cover registry option in container.rst
2026-10-11 20:54 [PATCH 1/2] scripts: add --registry option to container tool Guillaume Tucker
@ 2026-10-11 20:54 ` Guillaume Tucker
2026-10-12 21:48 ` Guillaume Tucker
2026-10-11 21:13 ` [PATCH 1/2] scripts: add --registry option to container tool Guillaume Tucker
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Guillaume Tucker @ 2026-10-11 20:54 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier, Jonathan Corbet, Miguel Ojeda
Cc: Guillaume Tucker, Onur Özkan, linux-doc, workflows,
linux-kbuild, linux-kernel
Add the corresponding documentation entry for the new --registry
command line option and TOML configuration file. Update the examples
accordingly to show how this can be used to override a registry name
already defined within a default image name.
Signed-off-by: Guillaume Tucker <gtucker@gtucker.io>
---
Documentation/dev-tools/container.rst | 33 +++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/Documentation/dev-tools/container.rst b/Documentation/dev-tools/container.rst
index 5dde95f6b222..3f2ba1fcf3bf 100644
--- a/Documentation/dev-tools/container.rst
+++ b/Documentation/dev-tools/container.rst
@@ -48,6 +48,13 @@ Available options:
Profile section to use in the config file. This will override any values
defined in the ``DEFAULT`` section.
+``-R, --registry REGISTRY``
+
+ Container registry name.
+
+ Any registry already included in the image name will be replaced or removed
+ when using this option with no value.
+
``-r, --runtime RUNTIME``
Container runtime name. Supported runtimes: ``podman``, ``docker``.
@@ -274,6 +281,15 @@ Supported options in each section are:
Name of the container image to use, equivalent to the ``-i`` command line
option.
+``registry``
+
+ Name of the container image registry to use, equivalent to the ``-R``
+ command line option. This will be used as a prefix before the image name
+ with a ``/`` separator.
+
+ For example, a ``docker.io`` registry and a ``myuser/myimage`` image will
+ result in ``docker.io/myuser/myimage`` as the full image path.
+
``runtime``
Name of the container runtime, equivalent to the ``-r`` command line option.
@@ -288,6 +304,7 @@ Here's a sample configuration with an extra ``clang`` profile::
[DEFAULT]
runtime = "podman"
+ registry = "docker.io"
image = "tuxmake/korg-gcc"
[clang]
@@ -306,10 +323,18 @@ Using the configuration file, it can now be simplified into this::
scripts/container -p clang -- make defconfig
-Then to override the default user, the ``-u`` option can still be used::
+Then to override the default runtime, the ``-r`` option can still be used::
+
+ scripts/container -p clang -r docker -- make defconfig
+
+Likewise, to override the registry name::
+
+ scripts/container -p clang -R my.registry.com -- make defconfig
+
+Or to not use any registry at all but only a local image::
- scripts/container -p clang -u0 -- make defconfig
+ scripts/container -p clang -R -- make defconfig
-This also illustrates how values take precedence over each other: the runtime
+This also illustrates how values take precedence over each other: the registry
is loaded from the ``DEFAULT`` section, the image from the ``clang`` section
-and the user ID from the command line ``-u`` option.
+and the runtime from the command line ``-r`` option.
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] scripts: add --registry option to container tool
2026-10-11 20:54 [PATCH 1/2] scripts: add --registry option to container tool Guillaume Tucker
2026-10-11 20:54 ` [PATCH 2/2] Documentation: dev-tools: cover registry option in container.rst Guillaume Tucker
@ 2026-10-11 21:13 ` Guillaume Tucker
2026-10-12 21:31 ` Guillaume Tucker
2026-11-05 4:29 ` Nathan Chancellor
3 siblings, 0 replies; 7+ messages in thread
From: Guillaume Tucker @ 2026-10-11 21:13 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier, Jonathan Corbet, Miguel Ojeda
Cc: Onur Özkan, linux-doc, workflows, linux-kbuild, linux-kernel
On 11/10/2026 10:54 pm, Guillaume Tucker wrote:
> Add a --registry / -R command line argument to the container tool to
> specify an altnerative image registry and support it in the TOML
> configuration file accordingly.
>
> This uses a mechanism based on regular expressions to parse the
> container registry and image names and construct the final one based
> on a set of priority rules. A registry can be included directly in an
> image name; an empty string means a local image. It can then be
> overridden by explicitly specifying a registry name via the CLI option
> or the TOML file, with the CLI option taking precedence as always.
>
> Signed-off-by: Guillaume Tucker <gtucker@gtucker.io>
> ---
> scripts/container | 126 ++++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 117 insertions(+), 9 deletions(-)
>
> diff --git a/scripts/container b/scripts/container
> index a3a55180d6ed..de72725656a8 100755
> --- a/scripts/container
> +++ b/scripts/container
[...]
> +@dataclasses.dataclass
> +class FullImageName(ImageParserMixin):
> + """Parsed image name including an optional registry"""
> + image: ImageName
> + registry: RegistryName = None
> + _regex = re.compile(
> + rf'^((?P<registry>{REGISTRY_REGEX})\/)?(?P<image>{IMAGE_REGEX})?$'
> + )
> +
> + @property
> + def name(self):
> + """Full name in registry/image:tag format with optional registry"""
> + return (
> + '/'.join((self.registry.registry, self.image.image))
> + if self.registry else self.image.image
> + )
> +
> + @classmethod
> + def from_name(cls, name):
> + if re_match := cls._regex.match(name):
> + fields = re_match.groupdict()
> + return FullImageName(
> + registry=RegistryName.from_fields(fields),
> + image=ImageName.from_fields(fields),
> + )
> + return None
> +
> +
As one would expect, Sashiko has some opinions about this:
https://sashiko.dev/#/patchset/06ee7c694c3e9716bff5c9b1b8e9dc95cc0b38d3.1791751900.git.gtucker%40gtucker.io
I would say that at least half of it is slightly bogus but I'll
address them in detail in due time. Also I've prepared some unit
tests to cover this logic and will send them as an RFC separately.
In the meantime, I'd be interested to know if anyone has some
feedback on the features themselves from a developer point of view.
Best wishes,
Guillaume
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] scripts: add --registry option to container tool
2026-10-11 20:54 [PATCH 1/2] scripts: add --registry option to container tool Guillaume Tucker
2026-10-11 20:54 ` [PATCH 2/2] Documentation: dev-tools: cover registry option in container.rst Guillaume Tucker
2026-10-11 21:13 ` [PATCH 1/2] scripts: add --registry option to container tool Guillaume Tucker
@ 2026-10-12 21:31 ` Guillaume Tucker
2026-11-05 4:29 ` Nathan Chancellor
3 siblings, 0 replies; 7+ messages in thread
From: Guillaume Tucker @ 2026-10-12 21:31 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier, Jonathan Corbet, Miguel Ojeda
Cc: Onur Özkan, linux-doc, workflows, linux-kbuild, linux-kernel
On 11/10/2026 10:54 pm, Guillaume Tucker wrote:
> Add a --registry / -R command line argument to the container tool to
> specify an altnerative image registry and support it in the TOML
> configuration file accordingly.
>
> This uses a mechanism based on regular expressions to parse the
> container registry and image names and construct the final one based
> on a set of priority rules. A registry can be included directly in an
> image name; an empty string means a local image. It can then be
> overridden by explicitly specifying a registry name via the CLI option
> or the TOML file, with the CLI option taking precedence as always.
>
> Signed-off-by: Guillaume Tucker <gtucker@gtucker.io>
> ---
> scripts/container | 126 ++++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 117 insertions(+), 9 deletions(-)
>
> diff --git a/scripts/container b/scripts/container
> index a3a55180d6ed..de72725656a8 100755
> --- a/scripts/container
> +++ b/scripts/container
> @@ -10,6 +10,7 @@ import dataclasses
> import logging
> import os
> import pathlib
> +import re
> import shutil
> import subprocess
> import sys
> @@ -17,6 +18,89 @@ import tomllib
> import uuid
>
>
> +def _init_registry_regex():
> + domain = r'[{anum}][{anum}-]*\.[{anum}\.-]*[{anum}]'.format(anum=r'a-z0-9')
Sashiko wrote:
> Does this hardcoded requirement for a literal dot in the domain
> regex prevent the use of single-component hosts like localhost?
That's fair enough, a plain host can be used as long as a port number
is also provided. So localhost/image wouldn't work as it would be
considered part of the image path, but localhost:5000/image is valid.
I'll fix this in a v2.
> + ipv6 = r'\[[a-fA-F0-9\:]+\]'
> + port = r'[\d]{1,5}'
> + return rf'((?P<domain>{domain})|(?P<ipv6>{ipv6}))(\:(?P<port>{port}))?'
> +
> +
> +def _init_image_regex():
> + step = r'([{anum}]|[{anum}][a-z0-9_\.\-]*[{anum}])'.format(anum=r'a-z0-9')
> + tag = r'[a-zA-Z0-9_][a-zA-Z0-9_\.\-\/]{0,127}'
> + return rf'(?P<path>{step}(\/{step})*)(\:(?P<tag>{tag}))?'
> +
> +
> +REGISTRY_REGEX = _init_registry_regex()
> +IMAGE_REGEX = _init_image_regex()
> +
> +
> +class ImageParserMixin:
> + """Helper mixin to parse container image names"""
> +
> + @classmethod
> + def from_fields(cls, fields):
> + """Get an object using a valid subset of fields or None"""
> + kwargs = {}
> + for field in dataclasses.fields(cls):
> + if value := fields.get(field.name):
> + kwargs[field.name] = value
> + return cls(**kwargs) if kwargs else None
> +
> + @classmethod
> + def from_name(cls, name):
> + """Get an object using fields in the name matching ._regex or None"""
> + re_match = cls._regex.match(name)
> + return cls.from_fields(re_match.groupdict()) if re_match else None
> +
> +
> +@dataclasses.dataclass
> +class RegistryName(ImageParserMixin):
> + """Parsed container registry name with no image"""
> + registry: str = None
> + domain: str = None
> + ipv6: str = None
> + port: str = None
> + _regex = re.compile(rf'^(?P<registry>{REGISTRY_REGEX})$')
> +
> +
> +@dataclasses.dataclass
> +class ImageName(ImageParserMixin):
> + """Parsed container image name with no registry"""
> + image: str = None
> + path: str = None
> + tag: str = None
> + _regex = re.compile(rf'^(?P<image>{IMAGE_REGEX})$')
> +
> +
> +@dataclasses.dataclass
> +class FullImageName(ImageParserMixin):
> + """Parsed image name including an optional registry"""
> + image: ImageName
> + registry: RegistryName = None
> + _regex = re.compile(
> + rf'^((?P<registry>{REGISTRY_REGEX})\/)?(?P<image>{IMAGE_REGEX})?$'
> + )
> +
> + @property
> + def name(self):
> + """Full name in registry/image:tag format with optional registry"""
> + return (
> + '/'.join((self.registry.registry, self.image.image))
> + if self.registry else self.image.image
> + )
Sashiko wrote:
> Could this result in an AttributeError if self.image is None when
> accessing self.image.image?
In theory that's true, but the whole point is to initialise the class
using the regex parsing mechanism and when doing this, the field
would never be None. If it failed to parse the FullImageName object
wouldn't be constructed at all when using .from_name(). So an
exception if .image was None would seem justified - or even an
assert.
> + @classmethod
> + def from_name(cls, name):
> + if re_match := cls._regex.match(name):
> + fields = re_match.groupdict()
> + return FullImageName(
> + registry=RegistryName.from_fields(fields),
> + image=ImageName.from_fields(fields),
> + )
> + return None
Sashiko wrote:
> If the user provides an image name with a trailing slash like
> registry.com/, does the optional image capture group match nothing?
Ah yes, but that's a small bug in the regex due to the trailing '?'
which makes the image optional when it shouldn't. I'll fix this in a
v2 - and I guess it might explain the previous comment as if the
image part is not optional then .image should never be None.
> +
> class ContainerRuntime(abc.ABC):
> """Base class for a container runtime implementation"""
>
> @@ -145,6 +229,7 @@ class Config:
> """Container configuration"""
> image: str = None
> runtime: str = None
> + registry: str = None
> env_file: str = None
> uid: int = None
> gid: int = None
> @@ -188,23 +273,40 @@ def _get_logger(verbose):
> return logger
>
>
> +def _get_image(args, config):
> + image_name = args.image or config.image
> + if not image_name:
> + raise ValueError("no image specified")
> + image = FullImageName.from_name(image_name)
> + if image is None:
> + raise ValueError(f"invalid image name: {image_name}")
> + if args.registry == '':
> + image.registry = None
> + elif args.registry is not None:
> + image.registry = RegistryName.from_name(args.registry)
> + if image.registry is None:
> + raise ValueError(f"invalid registry name: {args.registry}")
> + elif config.registry is not None and image.registry is None:
> + image.registry = RegistryName.from_name(config.registry)
> + if image.registry is None:
> + raise ValueError(f"invalid registry name: {config.registry}")
> + return image
> +
> +
> def main(args):
> """Main entry point for the container tool"""
> logger = _get_logger(args.verbose)
> try:
> config = Config.from_toml(args.config_file, args.config_profile)
> - runtime = args.runtime or config.runtime
> - cls = Runtimes.get(runtime) if runtime else Runtimes.find()
> + runtime_name = args.runtime or config.runtime
> + cls = Runtimes.get(runtime_name) if runtime_name else Runtimes.find()
> + logger.debug("runtime: %s", cls.name)
> + image = _get_image(args, config)
> + logger.debug("image: %s", image.name)
> except ValueError as ex:
> logger.error(ex)
> return 1
> - logger.debug("runtime: %s", cls.name)
> - image = args.image or config.image
> - if not image:
> - logger.error("no image specified")
> - return 1
> - logger.debug("image: %s", image)
> - return cls(args, config, logger).run(image, args.cmd)
> + return cls(args, config, logger).run(image.name, args.cmd)
>
>
> if __name__ == '__main__':
> @@ -235,6 +337,12 @@ if __name__ == '__main__':
> help="Profile section to use in the config file. This will override "
> "any values defined in the DEFAULT section."
> )
> + parser.add_argument(
> + '-R', '--registry', nargs='?', const='',
> + help="Container registry name. Any registry already included in the "
> + "image name will be replaced or removed when using this option with "
> + "no value."
> + )
> parser.add_argument(
> '-r', '--runtime', choices=Runtimes.get_names(),
> help="Container runtime name. If not specified, the first one found "
The rest of this patch appears to be Shashiko-friendly, at least in
this iteration. I'm updating the unit tests accordingly and will
send them in an RFC alongside the v2.
Guillaume
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] Documentation: dev-tools: cover registry option in container.rst
2026-10-11 20:54 ` [PATCH 2/2] Documentation: dev-tools: cover registry option in container.rst Guillaume Tucker
@ 2026-10-12 21:48 ` Guillaume Tucker
0 siblings, 0 replies; 7+ messages in thread
From: Guillaume Tucker @ 2026-10-12 21:48 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier, Jonathan Corbet, Miguel Ojeda
Cc: Onur Özkan, linux-doc, workflows, linux-kbuild, linux-kernel
On 11/10/2026 10:54 pm, Guillaume Tucker wrote:
> Add the corresponding documentation entry for the new --registry
> command line option and TOML configuration file. Update the examples
> accordingly to show how this can be used to override a registry name
> already defined within a default image name.
Sashiko wrote:
> Does the patch contain these examples?
>
> The commit message mentions showing how to override a registry name
> already defined within a default image name, but the examples added
> in the patch only show overriding the registry setting in the
> configuration file, not an embedded registry within an image
> string.
By 'default' I meant an image name that would be used without
specifying it on the command line with the -i option. That's not the
same as the [DEFAULT] section in the TOML file. But it's true it
could be clarified by mentioning an image name from a profile section
instead, so I'll reword this in the v2.
> Signed-off-by: Guillaume Tucker <gtucker@gtucker.io>
> ---
> Documentation/dev-tools/container.rst | 33 +++++++++++++++++++++++----
> 1 file changed, 29 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/dev-tools/container.rst b/Documentation/dev-tools/container.rst
> index 5dde95f6b222..3f2ba1fcf3bf 100644
> --- a/Documentation/dev-tools/container.rst
> +++ b/Documentation/dev-tools/container.rst
> @@ -48,6 +48,13 @@ Available options:
> Profile section to use in the config file. This will override any values
> defined in the ``DEFAULT`` section.
>
> +``-R, --registry REGISTRY``
> +
> + Container registry name.
> +
> + Any registry already included in the image name will be replaced or removed
> + when using this option with no value.
> +
> ``-r, --runtime RUNTIME``
>
> Container runtime name. Supported runtimes: ``podman``, ``docker``.
> @@ -274,6 +281,15 @@ Supported options in each section are:
> Name of the container image to use, equivalent to the ``-i`` command line
> option.
>
> +``registry``
> +
> + Name of the container image registry to use, equivalent to the ``-R``
> + command line option. This will be used as a prefix before the image name
> + with a ``/`` separator.
> +
> + For example, a ``docker.io`` registry and a ``myuser/myimage`` image will
> + result in ``docker.io/myuser/myimage`` as the full image path.
> +
> ``runtime``
>
> Name of the container runtime, equivalent to the ``-r`` command line option.
> @@ -288,6 +304,7 @@ Here's a sample configuration with an extra ``clang`` profile::
>
> [DEFAULT]
> runtime = "podman"
> + registry = "docker.io"
> image = "tuxmake/korg-gcc"
>
> [clang]
> @@ -306,10 +323,18 @@ Using the configuration file, it can now be simplified into this::
>
> scripts/container -p clang -- make defconfig
>
> -Then to override the default user, the ``-u`` option can still be used::
> +Then to override the default runtime, the ``-r`` option can still be used::
> +
> + scripts/container -p clang -r docker -- make defconfig
> +
> +Likewise, to override the registry name::
> +
> + scripts/container -p clang -R my.registry.com -- make defconfig
> +
> +Or to not use any registry at all but only a local image::
>
> - scripts/container -p clang -u0 -- make defconfig
> + scripts/container -p clang -R -- make defconfig
>
> -This also illustrates how values take precedence over each other: the runtime
> +This also illustrates how values take precedence over each other: the registry
> is loaded from the ``DEFAULT`` section, the image from the ``clang`` section
> -and the user ID from the command line ``-u`` option.
> +and the runtime from the command line ``-r`` option.
Sashiko wrote:
> Does this explanation still match the example directly above it?
>
> The text explains that the registry is loaded from the DEFAULT
> section and the runtime from the command line -r option. However,
> the immediately preceding example is "scripts/container -p clang -R
> -- make defconfig", where the registry is explicitly cleared and
> there is no -r option used.
I see the issue, registry and runtime were swapped in the sentence.
This would be correct:
This also illustrates how values take precedence over each other:
the runtime is loaded from the ``DEFAULT`` section, the image
from the ``clang`` section and the registry removed via the
command line ``-R`` option.
I'll fix this in the v2 as well.
There were a couple of other comments already addressed in the first
patch about using hostnames rather than domain names, so nothing
further to add here about them.
And if anyone is wondering why it's useful to be able to override the
registry, a typical use case is when making modified images locally
before pushing them to a registry or when pulling images from a
development registry instead. Say, in the TOML file a user can set
some standard images to be pulled from a public registry. Then when
building a variant of an image, the user can just use the -R option
to pick it up instead of editing the file or duplicating profile
entries. Validating the image names seems useful and it's a small
extra to be able to override the registry part once it's all parsed
into objects. So it seems worth the extra few lines of code.
Guillaume
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] scripts: add --registry option to container tool
2026-10-11 20:54 [PATCH 1/2] scripts: add --registry option to container tool Guillaume Tucker
` (2 preceding siblings ...)
2026-10-12 21:31 ` Guillaume Tucker
@ 2026-11-05 4:29 ` Nathan Chancellor
2026-11-14 13:15 ` Guillaume Tucker
3 siblings, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2026-11-05 4:29 UTC (permalink / raw)
To: Guillaume Tucker
Cc: Nathan Chancellor, Nicolas Schier, Jonathan Corbet, Miguel Ojeda,
Onur Özkan, linux-doc, workflows, linux-kbuild,
linux-kernel
> Add a --registry / -R command line argument to the container tool to
> specify an altnerative image registry and support it in the TOML
> configuration file accordingly.
>
> This uses a mechanism based on regular expressions to parse the
> container registry and image names and construct the final one based
> on a set of priority rules. A registry can be included directly in an
> image name; an empty string means a local image. It can then be
> overridden by explicitly specifying a registry name via the CLI option
> or the TOML file, with the CLI option taking precedence as always.
>
> Signed-off-by: Guillaume Tucker <gtucker@gtucker.io>
Hi Guillaume,
I don't have any real strong opinions on the patch itself (although
Sashiko seems to have its usual complaints about validation and such)
but I am not sure the commit message or documentation make it very clear
why it is useful to support this. In theory, the registry can be added
to the image parameter, is that not sufficient?
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] scripts: add --registry option to container tool
2026-11-05 4:29 ` Nathan Chancellor
@ 2026-11-14 13:15 ` Guillaume Tucker
0 siblings, 0 replies; 7+ messages in thread
From: Guillaume Tucker @ 2026-11-14 13:15 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Nicolas Schier, Jonathan Corbet, Miguel Ojeda, Onur Özkan,
linux-doc, workflows, linux-kbuild, linux-kernel,
Konstantin Ryabitsev
Hi Nathan,
On 05/11/2026 5:29 am, Nathan Chancellor wrote:
>> Add a --registry / -R command line argument to the container tool to
>> specify an altnerative image registry and support it in the TOML
>> configuration file accordingly.
>>
>> This uses a mechanism based on regular expressions to parse the
>> container registry and image names and construct the final one based
>> on a set of priority rules. A registry can be included directly in an
>> image name; an empty string means a local image. It can then be
>> overridden by explicitly specifying a registry name via the CLI option
>> or the TOML file, with the CLI option taking precedence as always.
>>
>> Signed-off-by: Guillaume Tucker <gtucker@gtucker.io>
>
> Hi Guillaume,
>
> I don't have any real strong opinions on the patch itself (although
> Sashiko seems to have its usual complaints about validation and such)
> but I am not sure the commit message or documentation make it very clear
> why it is useful to support this. In theory, the registry can be added
> to the image parameter, is that not sufficient?
Thanks for taking a look. Yes, after taking a step back I tend to
agree with this too. In fact it seems like doing the work for this
series helped prove it was generally a bad idea in the end. It's
over-complicating things and causes some code bloat for very little
useful features. There are corner use cases where it makes things a
bit easier e.g. when building a modified container image locally or
on an alternative registry, but handling the full image path isn't
such a big deal.
Validating the image name is also not strictly required IMHO as the
underlying tools e.g. Podman or Docker will report any problems
anyway. I'll see if we can still have just the regex validation in
place without the extra CLI options, maybe send an RFC but if that's
also bloating the code then I would probably just drop this series
altogether.
As a collateral benefit, I basically ended up with a small Python
package to parse container image names so I might tidy that up and
submit it to PyPI :) Or upstream it in an OCI toolbox or something.
I haven't found any ready-to-use one, all the container runtimes have
their own independent implementation.
Looking ahead, the next item on my list is to improve out-of-tree
build support with the tool so I'll start tackling that soon. And
the related topic of hosting reference images in a kernel.org
registry[1] is also making some progress after some discussions at
Kernel Recipes and Plumbers too. We've reached a consensus with
several key maintainers so we now need to find a way to land this.
Best wishes,
Guillaume
[1]
https://lore.kernel.org/all/01a87de4-8de5-4ff0-941b-2e5932a3a19c@gtucker.io/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-14 13:15 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-11 20:54 [PATCH 1/2] scripts: add --registry option to container tool Guillaume Tucker
2026-10-11 20:54 ` [PATCH 2/2] Documentation: dev-tools: cover registry option in container.rst Guillaume Tucker
2026-10-12 21:48 ` Guillaume Tucker
2026-10-11 21:13 ` [PATCH 1/2] scripts: add --registry option to container tool Guillaume Tucker
2026-10-12 21:31 ` Guillaume Tucker
2026-11-05 4:29 ` Nathan Chancellor
2026-11-14 13:15 ` Guillaume Tucker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®