Documentation/dev-tools/container.rst

Source file repositories/reference/linux-study-clean/Documentation/dev-tools/container.rst

File Facts

System
Linux kernel
Corpus path
Documentation/dev-tools/container.rst
Extension
.rst
Size
8539 bytes
Lines
228
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

.. SPDX-License-Identifier: GPL-2.0-only
.. Copyright (C) 2025 Guillaume Tucker

====================
Containerized Builds
====================

The ``container`` tool can be used to run any command in the kernel source tree
from within a container.  Doing so facilitates reproducing builds across
various platforms, for example when a test bot has reported an issue which
requires a specific version of a compiler or an external test suite.  While
this can already be done by users who are familiar with containers, having a
dedicated tool in the kernel tree lowers the barrier to entry by solving common
problems once and for all (e.g. user id management).  It also makes it easier
to share an exact command line leading to a particular result.  The main use
case is likely to be kernel builds but virtually anything can be run: KUnit,
checkpatch etc. provided a suitable image is available.


Options
=======

Command line syntax::

  scripts/container -i IMAGE [OPTION]... CMD...

Available options:

``-e, --env-file ENV_FILE``

    Path to an environment file to load in the container.

``-g, --gid GID``

    Group id to use inside the container.

``-i, --image IMAGE``

    Container image name (required).

``-r, --runtime RUNTIME``

    Container runtime name.  Supported runtimes: ``docker``, ``podman``.

    If not specified, the first one found on the system will be used
    i.e. Podman if present, otherwise Docker.

``-s, --shell``

    Run the container in an interactive shell.

``-u, --uid UID``

    User id to use inside the container.

    If the ``-g`` option is not specified, the user id will also be used for
    the group id.

``-v, --verbose``

    Enable verbose output.

``-h, --help``

    Show the help message and exit.


Usage
=====

Annotation

Implementation Notes