bootc

package
v0.244.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package bootc handles resolving information from bootc-based containers for generating manifests for bootc-derived images.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDnf = errors.New("no dnf in container")

Functions

This section is empty.

Types

type Container

type Container struct {
	// contains filtered or unexported fields
}

Container is a simpler wrapper around a running podman container. This type isn't meant as a general-purpose container management tool, but as an opinonated library for bootc-image-builder.

func NewContainer

func NewContainer(ref string) (*Container, error)

New creates a new running container from the given image reference.

NB: - --net host is used to make networking work in a nested container - /run/secrets is mounted from the host to make sure RHSM credentials are available

func (*Container) Arch

func (c *Container) Arch() string

Arch returns the architecture of the container

func (*Container) CopyInto

func (c *Container) CopyInto(src, dest string) error

CopyInto copies a file into the container.

func (*Container) DefaultRootfsType

func (c *Container) DefaultRootfsType() (string, error)

DefaultRootfsType returns the default rootfs type (e.g. "ext4") as specified by the bootc container install configuration. An empty string is valid and means the container sets no default.

func (*Container) ExecArgv

func (c *Container) ExecArgv() []string

func (*Container) InitDNF

func (c *Container) InitDNF() error

InitDNF initializes dnf in the container. This is necessary when the caller wants to read the image's dnf repositories, but they are not static, but rather configured by dnf dynamically. The primaru use-case for this is RHEL and subscription-manager.

The implementation is simple: We just run plain `dnf` in the container so that the subscription-manager gets initialized. For compatibility with both dnf and dnf5 we cannot just run "dnf" as dnf5 will error and do nothing in this case. So we use "dnf check --duplicates" as this is fast on both dnf4/dnf5 (just doing "dnf5 check" without arguments takes around 25s so that is not a great option).

func (*Container) InitrdModules added in v0.243.0

func (c *Container) InitrdModules(kver string) ([]string, error)

InitrdModules gets the list of modules from the container's initrd

func (*Container) NewContainerSolver

func (cnt *Container) NewContainerSolver(cacheRoot string, architecture arch.Arch, sourceInfo *osinfo.Info) (*depsolvednf.Solver, error)

func (*Container) ReadFile

func (c *Container) ReadFile(path string) ([]byte, error)

Reads a file from the container

func (*Container) ResolveInfo

func (c *Container) ResolveInfo() (*Info, error)

ResolveInfo loads all information from the running container.

func (*Container) Root

func (c *Container) Root() string

Root returns the root directory of the container as available on the host.

func (*Container) Stop

func (c *Container) Stop() error

Stop stops the container. Since New() creates a container with --rm, this removes the container as well.

type Info

type Info struct {
	// The name of the container image that generated the info
	Imgref string

	// The container image ID
	ImageID string

	// Information related to the OS in the container
	OSInfo *osinfo.Info

	// The container's hardware architecture
	Arch string

	// The default root filesystem from the container's bootc config
	DefaultRootFs string

	// The size of the container image
	Size uint64
}

Info contains all the information from the bootc container that is required to create a manifest for a bootc-based image.

func ResolveBootcInfo added in v0.243.0

func ResolveBootcInfo(ref string) (*Info, error)

ResolveBootcInfo resolves the bootc container reference and returns the info structure

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL