container

package
v0.0.0-...-55c9cc8 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 New

func New(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) 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) NewContainerSolver

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

func (*Container) ReadFile

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

Reads a file from the 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.

Jump to

Keyboard shortcuts

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