Documentation
¶
Overview ¶
Package bootc handles resolving information from bootc-based containers for generating manifests for bootc-derived images.
Index ¶
- Variables
- type Container
- func (c *Container) Arch() string
- func (c *Container) CopyInto(src, dest string) error
- func (c *Container) DefaultRootfsType() (string, error)
- func (c *Container) ExecArgv() []string
- func (c *Container) InitDNF() error
- func (c *Container) InitrdModules(kver string) ([]string, error)
- func (cnt *Container) NewContainerSolver(cacheRoot string, architecture arch.Arch, sourceInfo *osinfo.Info) (*depsolvednf.Solver, error)
- func (c *Container) ReadFile(path string) ([]byte, error)
- func (c *Container) ResolveInfo() (*Info, error)
- func (c *Container) Root() string
- func (c *Container) Stop() error
- type Info
Constants ¶
This section is empty.
Variables ¶
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 ¶
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) DefaultRootfsType ¶
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) InitDNF ¶
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
InitrdModules gets the list of modules from the container's initrd
func (*Container) NewContainerSolver ¶
func (*Container) ResolveInfo ¶
ResolveInfo loads all information from the running container.
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
ResolveBootcInfo resolves the bootc container reference and returns the info structure