buildah: github.com/kris-nova/buildah Index | Files

package buildah

import "github.com/kris-nova/buildah"

Index

Package Files

add.go buildah.go commit.go common.go config.go delete.go image.go import.go mount.go new.go pull.go run.go run_linux.go seccomp_unsupported.go selinux_unsupported.go unmount.go util.go

Constants

const (
    // Package is the name of this package, used in help output and to
    // identify working containers.
    Package = "buildah"
    // Version for the Package.  Bump version in contrib/rpm/buildah.spec
    // too.
    Version = "1.5-dev"
)
const (
    // OCI used to define the "oci" image format
    OCI = "oci"
    // DOCKER used to define the "docker" image format
    DOCKER = "docker"
)
const (
    // OCIv1ImageManifest is the MIME type of an OCIv1 image manifest,
    // suitable for specifying as a value of the PreferredManifestType
    // member of a CommitOptions structure.  It is also the default.
    OCIv1ImageManifest = v1.MediaTypeImageManifest
    // Dockerv2ImageManifest is the MIME type of a Docker v2s2 image
    // manifest, suitable for specifying as a value of the
    // PreferredManifestType member of a CommitOptions structure.
    Dockerv2ImageManifest = manifest.DockerV2Schema2MediaType
)
const (
    // BaseImageFakeName is the "name" of a source image which we interpret
    // as "no image".
    BaseImageFakeName = imagebuilder.NoBaseImageSpecifier

    // DefaultTransport is a prefix that we apply to an image name if we
    // can't find one in the local Store, in order to generate a source
    // reference for the image that we can then copy to the local Store.
    DefaultTransport = "docker://"
)

func InitReexec Uses

func InitReexec() bool

InitReexec is a wrapper for reexec.Init(). It should be called at the start of main(), and if it returns true, main() should return immediately.

func Pull Uses

func Pull(ctx context.Context, imageName string, options PullOptions) (types.ImageReference, error)

Pull copies the contents of the image from somewhere else to local storage.

func Push Uses

func Push(ctx context.Context, image string, dest types.ImageReference, options PushOptions) (reference.Canonical, digest.Digest, error)

Push copies the contents of the image to a new location.

func ReserveSELinuxLabels Uses

func ReserveSELinuxLabels(store storage.Store, id string) error

ReserveSELinuxLabels reads containers storage and reserves SELinux containers fall all existing buildah containers

type AddAndCopyOptions Uses

type AddAndCopyOptions struct {
    // Chown is a spec for the user who should be given ownership over the
    // newly-added content, potentially overriding permissions which would
    // otherwise match those of local files and directories being copied.
    Chown string
    // All of the data being copied will pass through Hasher, if set.
    // If the sources are URLs or files, their contents will be passed to
    // Hasher.
    // If the sources include directory trees, Hasher will be passed
    // tar-format archives of the directory trees.
    Hasher io.Writer
}

AddAndCopyOptions holds options for add and copy commands.

type Builder Uses

type Builder struct {

    // Args define variables that users can pass at build-time to the builder
    Args map[string]string
    // Type is used to help identify a build container's metadata.  It
    // should not be modified.
    Type string `json:"type"`
    // FromImage is the name of the source image which was used to create
    // the container, if one was used.  It should not be modified.
    FromImage string `json:"image,omitempty"`
    // FromImageID is the ID of the source image which was used to create
    // the container, if one was used.  It should not be modified.
    FromImageID string `json:"image-id"`
    // Config is the source image's configuration.  It should not be
    // modified.
    Config []byte `json:"config,omitempty"`
    // Manifest is the source image's manifest.  It should not be modified.
    Manifest []byte `json:"manifest,omitempty"`

    // Container is the name of the build container.  It should not be modified.
    Container string `json:"container-name,omitempty"`
    // ContainerID is the ID of the build container.  It should not be modified.
    ContainerID string `json:"container-id,omitempty"`
    // MountPoint is the last location where the container's root
    // filesystem was mounted.  It should not be modified.
    MountPoint string `json:"mountpoint,omitempty"`
    // ProcessLabel is the SELinux process label associated with the container
    ProcessLabel string `json:"process-label,omitempty"`
    // MountLabel is the SELinux mount label associated with the container
    MountLabel string `json:"mount-label,omitempty"`

    // ImageAnnotations is a set of key-value pairs which is stored in the
    // image's manifest.
    ImageAnnotations map[string]string `json:"annotations,omitempty"`
    // ImageCreatedBy is a description of how this container was built.
    ImageCreatedBy string `json:"created-by,omitempty"`
    // ImageHistoryComment is a description of how our added layers were built.
    ImageHistoryComment string `json:"history-comment,omitempty"`

    // Image metadata and runtime settings, in multiple formats.
    OCIv1  v1.Image       `json:"ociv1,omitempty"`
    Docker docker.V2Image `json:"docker,omitempty"`
    // DefaultMountsFilePath is the file path holding the mounts to be mounted in "host-path:container-path" format.
    DefaultMountsFilePath string `json:"defaultMountsFilePath,omitempty"`

    // Isolation controls how we handle "RUN" statements and the Run() method.
    Isolation Isolation
    // NamespaceOptions controls how we set up the namespaces for processes that we run in the container.
    NamespaceOptions NamespaceOptions
    // ConfigureNetwork controls whether or not network interfaces and
    // routing are configured for a new network namespace (i.e., when not
    // joining another's namespace and not just using the host's
    // namespace), effectively deciding whether or not the process has a
    // usable network.
    ConfigureNetwork NetworkConfigurationPolicy
    // CNIPluginPath is the location of CNI plugin helpers, if they should be
    // run from a location other than the default location.
    CNIPluginPath string
    // CNIConfigDir is the location of CNI configuration files, if the files in
    // the default configuration directory shouldn't be used.
    CNIConfigDir string
    // ID mapping options to use when running processes in the container with non-host user namespaces.
    IDMappingOptions IDMappingOptions
    // AddCapabilities is a list of capabilities to add to the default set when running
    // commands in the container.
    AddCapabilities []string
    // DropCapabilities is a list of capabilities to remove from the default set,
    // after processing the AddCapabilities set, when running commands in the container.
    // If a capability appears in both lists, it will be dropped.
    DropCapabilities []string

    CommonBuildOpts *CommonBuildOptions
    // TopLayer is the top layer of the image
    TopLayer string
    // Format for the build Image
    Format string
    // contains filtered or unexported fields
}

Builder objects are used to represent containers which are being used to build images. They also carry potential updates which will be applied to the image's configuration when the container's contents are used to build an image.

func ImportBuilder Uses

func ImportBuilder(ctx context.Context, store storage.Store, options ImportOptions) (*Builder, error)

ImportBuilder creates a new build configuration using an already-present container.

func ImportBuilderFromImage Uses

func ImportBuilderFromImage(ctx context.Context, store storage.Store, options ImportFromImageOptions) (*Builder, error)

ImportBuilderFromImage creates a new builder configuration using an image. The returned object can be modified and examined, but it can not be saved or committed because it is not associated with a working container.

func NewBuilder Uses

func NewBuilder(ctx context.Context, store storage.Store, options BuilderOptions) (*Builder, error)

NewBuilder creates a new build container.

func OpenAllBuilders Uses

func OpenAllBuilders(store storage.Store) (builders []*Builder, err error)

OpenAllBuilders loads all containers which have a state file that we use in their data directory, typically so that they can be listed.

func OpenBuilder Uses

func OpenBuilder(store storage.Store, container string) (*Builder, error)

OpenBuilder loads information about a build container given its name or ID.

func OpenBuilderByPath Uses

func OpenBuilderByPath(store storage.Store, path string) (*Builder, error)

OpenBuilderByPath loads information about a build container given a path to the container's root filesystem

func (*Builder) Add Uses

func (b *Builder) Add(destination string, extract bool, options AddAndCopyOptions, source ...string) error

Add copies the contents of the specified sources into the container's root filesystem, optionally extracting contents of local files that look like non-empty archives.

func (*Builder) AddVolume Uses

func (b *Builder) AddVolume(v string)

AddVolume adds a location to the image's list of locations which should be mounted from outside of the container when a container based on an image built from this container is run.

func (*Builder) Annotations Uses

func (b *Builder) Annotations() map[string]string

Annotations returns a set of key-value pairs from the image's manifest.

func (*Builder) Architecture Uses

func (b *Builder) Architecture() string

Architecture returns a name of the architecture on which the container, or a container built using an image built from this container, is intended to be run.

func (*Builder) ClearAnnotations Uses

func (b *Builder) ClearAnnotations()

ClearAnnotations removes all keys and their values from the image's manifest.

func (*Builder) ClearEnv Uses

func (b *Builder) ClearEnv()

ClearEnv removes all values from the set of environment strings which should be set when running commands in this container, or in a container built using an image built from this container.

func (*Builder) ClearLabels Uses

func (b *Builder) ClearLabels()

ClearLabels removes all keys and their values from the image's runtime configuration.

func (*Builder) ClearOnBuild Uses

func (b *Builder) ClearOnBuild()

ClearOnBuild removes all values from the OnBuild structure

func (*Builder) ClearPorts Uses

func (b *Builder) ClearPorts()

ClearPorts empties the set of ports which should be exposed when a container based on an image built from this container is run.

func (*Builder) ClearVolumes Uses

func (b *Builder) ClearVolumes()

ClearVolumes removes all locations from the image's list of locations which should be mounted from outside of the container when a container based on an image built from this container is run.

func (*Builder) Cmd Uses

func (b *Builder) Cmd() []string

Cmd returns the default command, or command parameters if an Entrypoint is set, to use when running a container built from an image built from this container.

func (*Builder) Comment Uses

func (b *Builder) Comment() string

Comment returns the comment which will be set in the container and in containers built using images built from the container

func (*Builder) Commit Uses

func (b *Builder) Commit(ctx context.Context, dest types.ImageReference, options CommitOptions) (string, reference.Canonical, digest.Digest, error)

Commit writes the contents of the container, along with its updated configuration, to a new image in the specified location, and if we know how, add any additional tags that were specified. Returns the ID of the new image if commit was successful and the image destination was local

func (*Builder) CreatedBy Uses

func (b *Builder) CreatedBy() string

CreatedBy returns a description of how this image was built.

func (*Builder) Delete Uses

func (b *Builder) Delete() error

Delete removes the working container. The buildah.Builder object should not be used after this method is called.

func (*Builder) Domainname Uses

func (b *Builder) Domainname() string

Domainname returns the domainname which will be set in the container and in containers built using images built from the container.

func (*Builder) Entrypoint Uses

func (b *Builder) Entrypoint() []string

Entrypoint returns the command to be run for containers built from images built from this container.

func (*Builder) Env Uses

func (b *Builder) Env() []string

Env returns a list of key-value pairs to be set when running commands in the container, or in a container built using an image built from this container.

func (*Builder) HistoryComment Uses

func (b *Builder) HistoryComment() string

HistoryComment returns the comment which will be used in the history item which will describe the latest layer when we commit an image.

func (*Builder) Hostname Uses

func (b *Builder) Hostname() string

Hostname returns the hostname which will be set in the container and in containers built using images built from the container.

func (*Builder) Labels Uses

func (b *Builder) Labels() map[string]string

Labels returns a set of key-value pairs from the image's runtime configuration.

func (*Builder) Maintainer Uses

func (b *Builder) Maintainer() string

Maintainer returns contact information for the person who built the image.

func (*Builder) Mount Uses

func (b *Builder) Mount(label string) (string, error)

Mount mounts a container's root filesystem in a location which can be accessed from the host, and returns the location.

func (*Builder) OS Uses

func (b *Builder) OS() string

OS returns a name of the OS on which the container, or a container built using an image built from this container, is intended to be run.

func (*Builder) OnBuild Uses

func (b *Builder) OnBuild() []string

OnBuild returns the OnBuild value from the container.

func (*Builder) Ports Uses

func (b *Builder) Ports() []string

Ports returns the set of ports which should be exposed when a container based on an image built from this container is run.

func (*Builder) RemoveVolume Uses

func (b *Builder) RemoveVolume(v string)

RemoveVolume removes a location from the list of locations which should be mounted from outside of the container when a container based on an image built from this container is run.

func (*Builder) Run Uses

func (b *Builder) Run(command []string, options RunOptions) error

Run runs the specified command in the container's root filesystem.

func (*Builder) Save Uses

func (b *Builder) Save() error

Save saves the builder's current state to the build container's metadata. This should not need to be called directly, as other methods of the Builder object take care of saving their state.

func (*Builder) SetAnnotation Uses

func (b *Builder) SetAnnotation(key, value string)

SetAnnotation adds or overwrites a key's value from the image's manifest. Note: this setting is not present in the Docker v2 image format, so it is discarded when writing images using Docker v2 formats.

func (*Builder) SetArchitecture Uses

func (b *Builder) SetArchitecture(arch string)

SetArchitecture sets the name of the architecture on which the container, or a container built using an image built from this container, is intended to be run.

func (*Builder) SetCmd Uses

func (b *Builder) SetCmd(cmd []string)

SetCmd sets the default command, or command parameters if an Entrypoint is set, to use when running a container built from an image built from this container.

func (*Builder) SetComment Uses

func (b *Builder) SetComment(comment string)

SetComment sets the comment which will be set in the container and in containers built using images built from the container. Note: this setting is not present in the OCIv1 image format, so it is discarded when writing images using OCIv1 formats.

func (*Builder) SetCreatedBy Uses

func (b *Builder) SetCreatedBy(how string)

SetCreatedBy sets the description of how this image was built.

func (*Builder) SetDefaultMountsFilePath Uses

func (b *Builder) SetDefaultMountsFilePath(path string)

SetDefaultMountsFilePath sets the mounts file path for testing purposes

func (*Builder) SetDomainname Uses

func (b *Builder) SetDomainname(name string)

SetDomainname sets the domainname which will be set in the container and in containers built using images built from the container. Note: this setting is not present in the OCIv1 image format, so it is discarded when writing images using OCIv1 formats.

func (*Builder) SetEntrypoint Uses

func (b *Builder) SetEntrypoint(ep []string)

SetEntrypoint sets the command to be run for in containers built from images built from this container.

func (*Builder) SetEnv Uses

func (b *Builder) SetEnv(k string, v string)

SetEnv adds or overwrites a value to the set of environment strings which should be set when running commands in the container, or in a container built using an image built from this container.

func (*Builder) SetHistoryComment Uses

func (b *Builder) SetHistoryComment(comment string)

SetHistoryComment sets the comment which will be used in the history item which will describe the latest layer when we commit an image.

func (*Builder) SetHostname Uses

func (b *Builder) SetHostname(name string)

SetHostname sets the hostname which will be set in the container and in containers built using images built from the container. Note: this setting is not present in the OCIv1 image format, so it is discarded when writing images using OCIv1 formats.

func (*Builder) SetLabel Uses

func (b *Builder) SetLabel(k string, v string)

SetLabel adds or overwrites a key's value from the image's runtime configuration.

func (*Builder) SetMaintainer Uses

func (b *Builder) SetMaintainer(who string)

SetMaintainer sets contact information for the person who built the image.

func (*Builder) SetOS Uses

func (b *Builder) SetOS(os string)

SetOS sets the name of the OS on which the container, or a container built using an image built from this container, is intended to be run.

func (*Builder) SetOnBuild Uses

func (b *Builder) SetOnBuild(onBuild string)

SetOnBuild sets a trigger instruction to be executed when the image is used as the base of another image. Note: this setting is not present in the OCIv1 image format, so it is discarded when writing images using OCIv1 formats.

func (*Builder) SetPort Uses

func (b *Builder) SetPort(p string)

SetPort adds or overwrites an exported port in the set of ports which should be exposed when a container based on an image built from this container is run.

func (*Builder) SetShell Uses

func (b *Builder) SetShell(shell []string)

SetShell sets the default shell for running commands in the container, or in a container built using an image built from this container. Note: this setting is not present in the OCIv1 image format, so it is discarded when writing images using OCIv1 formats.

func (*Builder) SetStopSignal Uses

func (b *Builder) SetStopSignal(stopSignal string)

SetStopSignal sets the signal which will be set in the container and in containers built using images built from the container.

func (*Builder) SetUser Uses

func (b *Builder) SetUser(spec string)

SetUser sets information about the user as whom the container, or a container built using an image built from this container, should be run. Acceptable forms are a user name or ID, optionally followed by a colon and a group name or ID.

func (*Builder) SetWorkDir Uses

func (b *Builder) SetWorkDir(there string)

SetWorkDir sets the location of the default working directory for running commands in the container, or in a container built using an image built from this container.

func (*Builder) Shell Uses

func (b *Builder) Shell() []string

Shell returns the default shell for running commands in the container, or in a container built using an image built from this container.

func (*Builder) StopSignal Uses

func (b *Builder) StopSignal() string

StopSignal returns the signal which will be set in the container and in containers built using images buiilt from the container

func (*Builder) Unmount Uses

func (b *Builder) Unmount() error

Unmount unmounts a build container.

func (*Builder) UnsetAnnotation Uses

func (b *Builder) UnsetAnnotation(key string)

UnsetAnnotation removes a key and its value from the image's manifest, if it's present.

func (*Builder) UnsetEnv Uses

func (b *Builder) UnsetEnv(k string)

UnsetEnv removes a value from the set of environment strings which should be set when running commands in this container, or in a container built using an image built from this container.

func (*Builder) UnsetLabel Uses

func (b *Builder) UnsetLabel(k string)

UnsetLabel removes a key and its value from the image's runtime configuration, if it's present.

func (*Builder) UnsetPort Uses

func (b *Builder) UnsetPort(p string)

UnsetPort removes an exposed port from the set of ports which should be exposed when a container based on an image built from this container is run.

func (*Builder) User Uses

func (b *Builder) User() string

User returns information about the user as whom the container, or a container built using an image built from this container, should be run.

func (*Builder) Volumes Uses

func (b *Builder) Volumes() []string

Volumes returns a list of filesystem locations which should be mounted from outside of the container when a container built from an image built from this container is run.

func (*Builder) WorkDir Uses

func (b *Builder) WorkDir() string

WorkDir returns the default working directory for running commands in the container, or in a container built using an image built from this container.

type BuilderInfo Uses

type BuilderInfo struct {
    Type                  string
    FromImage             string
    FromImageID           string
    Config                string
    Manifest              string
    Container             string
    ContainerID           string
    MountPoint            string
    ProcessLabel          string
    MountLabel            string
    ImageAnnotations      map[string]string
    ImageCreatedBy        string
    OCIv1                 v1.Image
    Docker                docker.V2Image
    DefaultMountsFilePath string
    Isolation             string
    NamespaceOptions      NamespaceOptions
    ConfigureNetwork      string
    CNIPluginPath         string
    CNIConfigDir          string
    IDMappingOptions      IDMappingOptions
    DefaultCapabilities   []string
    AddCapabilities       []string
    DropCapabilities      []string
}

BuilderInfo are used as objects to display container information

func GetBuildInfo Uses

func GetBuildInfo(b *Builder) BuilderInfo

GetBuildInfo gets a pointer to a Builder object and returns a BuilderInfo object from it. This is used in the inspect command to display Manifest and Config as string and not []byte.

type BuilderOptions Uses

type BuilderOptions struct {
    // Args define variables that users can pass at build-time to the builder
    Args map[string]string
    // FromImage is the name of the image which should be used as the
    // starting point for the container.  It can be set to an empty value
    // or "scratch" to indicate that the container should not be based on
    // an image.
    FromImage string
    // Container is a desired name for the build container.
    Container string
    // PullPolicy decides whether or not we should pull the image that
    // we're using as a base image.  It should be PullIfMissing,
    // PullAlways, or PullNever.
    PullPolicy PullPolicy
    // Registry is a value which is prepended to the image's name, if it
    // needs to be pulled and the image name alone can not be resolved to a
    // reference to a source image.  No separator is implicitly added.
    Registry string
    // Transport is a value which is prepended to the image's name, if it
    // needs to be pulled and the image name alone, or the image name and
    // the registry together, can not be resolved to a reference to a
    // source image.  No separator is implicitly added.
    Transport string
    // Mount signals to NewBuilder() that the container should be mounted
    // immediately.
    Mount bool
    // SignaturePolicyPath specifies an override location for the signature
    // policy which should be used for verifying the new image as it is
    // being written.  Except in specific circumstances, no value should be
    // specified, indicating that the shared, system-wide default policy
    // should be used.
    SignaturePolicyPath string
    // ReportWriter is an io.Writer which will be used to log the reading
    // of the source image from a registry, if we end up pulling the image.
    ReportWriter io.Writer
    // github.com/containers/image/types SystemContext to hold credentials
    // and other authentication/authorization information.
    SystemContext *types.SystemContext
    // DefaultMountsFilePath is the file path holding the mounts to be
    // mounted in "host-path:container-path" format
    DefaultMountsFilePath string
    // Isolation controls how we handle "RUN" statements and the Run()
    // method.
    Isolation Isolation
    // NamespaceOptions controls how we set up namespaces for processes that
    // we might need to run using the container's root filesystem.
    NamespaceOptions NamespaceOptions
    // ConfigureNetwork controls whether or not network interfaces and
    // routing are configured for a new network namespace (i.e., when not
    // joining another's namespace and not just using the host's
    // namespace), effectively deciding whether or not the process has a
    // usable network.
    ConfigureNetwork NetworkConfigurationPolicy
    // CNIPluginPath is the location of CNI plugin helpers, if they should be
    // run from a location other than the default location.
    CNIPluginPath string
    // CNIConfigDir is the location of CNI configuration files, if the files in
    // the default configuration directory shouldn't be used.
    CNIConfigDir string
    // ID mapping options to use if we're setting up our own user namespace.
    IDMappingOptions *IDMappingOptions
    // AddCapabilities is a list of capabilities to add to the default set when
    // running commands in the container.
    AddCapabilities []string
    // DropCapabilities is a list of capabilities to remove from the default set,
    // after processing the AddCapabilities set, when running commands in the
    // container.  If a capability appears in both lists, it will be dropped.
    DropCapabilities []string

    CommonBuildOpts *CommonBuildOptions
    // Format for the container image
    Format string
}

BuilderOptions are used to initialize a new Builder.

type CommitOptions Uses

type CommitOptions struct {
    // PreferredManifestType is the preferred type of image manifest.  The
    // image configuration format will be of a compatible type.
    PreferredManifestType string
    // Compression specifies the type of compression which is applied to
    // layer blobs.  The default is to not use compression, but
    // archive.Gzip is recommended.
    Compression archive.Compression
    // SignaturePolicyPath specifies an override location for the signature
    // policy which should be used for verifying the new image as it is
    // being written.  Except in specific circumstances, no value should be
    // specified, indicating that the shared, system-wide default policy
    // should be used.
    SignaturePolicyPath string
    // AdditionalTags is a list of additional names to add to the image, if
    // the transport to which we're writing the image gives us a way to add
    // them.
    AdditionalTags []string
    // ReportWriter is an io.Writer which will be used to log the writing
    // of the new image.
    ReportWriter io.Writer
    // HistoryTimestamp is the timestamp used when creating new items in the
    // image's history.  If unset, the current time will be used.
    HistoryTimestamp *time.Time
    // github.com/containers/image/types SystemContext to hold credentials
    // and other authentication/authorization information.
    SystemContext *types.SystemContext
    // IIDFile tells the builder to write the image ID to the specified file
    IIDFile string
    // Squash tells the builder to produce an image with a single layer
    // instead of with possibly more than one layer.
    Squash bool

    // OnBuild is a list of commands to be run by images based on this image
    OnBuild []string
    // Parent is the base image that this image was created by.
    Parent string
}

CommitOptions can be used to alter how an image is committed.

type CommonBuildOptions Uses

type CommonBuildOptions struct {
    // AddHost is the list of hostnames to add to the build container's /etc/hosts.
    AddHost []string
    // CgroupParent is the path to cgroups under which the cgroup for the container will be created.
    CgroupParent string
    // CPUPeriod limits the CPU CFS (Completely Fair Scheduler) period
    CPUPeriod uint64
    // CPUQuota limits the CPU CFS (Completely Fair Scheduler) quota
    CPUQuota int64
    // CPUShares (relative weight
    CPUShares uint64
    // CPUSetCPUs in which to allow execution (0-3, 0,1)
    CPUSetCPUs string
    // CPUSetMems memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
    CPUSetMems string
    // Memory is the upper limit (in bytes) on how much memory running containers can use.
    Memory int64
    // MemorySwap limits the amount of memory and swap together.
    MemorySwap int64
    // LabelOpts is the a slice of fields of an SELinux context, given in "field:pair" format, or "disable".
    // Recognized field names are "role", "type", and "level".
    LabelOpts []string
    // SeccompProfilePath is the pathname of a seccomp profile.
    SeccompProfilePath string
    // ApparmorProfile is the name of an apparmor profile.
    ApparmorProfile string
    // ShmSize is the "size" value to use when mounting an shmfs on the container's /dev/shm directory.
    ShmSize string
    // Ulimit specifies resource limit options, in the form type:softlimit[:hardlimit].
    // These types are recognized:
    // "core": maximimum core dump size (ulimit -c)
    // "cpu": maximum CPU time (ulimit -t)
    // "data": maximum size of a process's data segment (ulimit -d)
    // "fsize": maximum size of new files (ulimit -f)
    // "locks": maximum number of file locks (ulimit -x)
    // "memlock": maximum amount of locked memory (ulimit -l)
    // "msgqueue": maximum amount of data in message queues (ulimit -q)
    // "nice": niceness adjustment (nice -n, ulimit -e)
    // "nofile": maximum number of open files (ulimit -n)
    // "nproc": maximum number of processes (ulimit -u)
    // "rss": maximum size of a process's (ulimit -m)
    // "rtprio": maximum real-time scheduling priority (ulimit -r)
    // "rttime": maximum amount of real-time execution between blocking syscalls
    // "sigpending": maximum number of pending signals (ulimit -i)
    // "stack": maximum stack size (ulimit -s)
    Ulimit []string
    // Volumes to bind mount into the container
    Volumes []string
}

CommonBuildOptions are resources that can be defined by flags for both buildah from and build-using-dockerfile

type IDMappingOptions Uses

type IDMappingOptions struct {
    HostUIDMapping bool
    HostGIDMapping bool
    UIDMap         []specs.LinuxIDMapping
    GIDMap         []specs.LinuxIDMapping
}

IDMappingOptions controls how we set up UID/GID mapping when we set up a user namespace.

type ImportFromImageOptions Uses

type ImportFromImageOptions struct {
    // Image is the name or ID of the image we'd like to examine.
    Image string
    // SignaturePolicyPath specifies an override location for the signature
    // policy which should be used for verifying the new image as it is
    // being written.  Except in specific circumstances, no value should be
    // specified, indicating that the shared, system-wide default policy
    // should be used.
    SignaturePolicyPath string
    // github.com/containers/image/types SystemContext to hold information
    // about which registries we should check for completing image names
    // that don't include a domain portion.
    SystemContext *types.SystemContext
}

ImportFromImageOptions are used to initialize a Builder from an image.

type ImportOptions Uses

type ImportOptions struct {
    // Container is the name of the build container.
    Container string
    // SignaturePolicyPath specifies an override location for the signature
    // policy which should be used for verifying the new image as it is
    // being written.  Except in specific circumstances, no value should be
    // specified, indicating that the shared, system-wide default policy
    // should be used.
    SignaturePolicyPath string
}

ImportOptions are used to initialize a Builder from an existing container which was created elsewhere.

type Isolation Uses

type Isolation int

Isolation provides a way to specify whether we're supposed to use a proper OCI runtime, or some other method for running commands.

const (
    // IsolationDefault is whatever we think will work best.
    IsolationDefault Isolation = iota
    // IsolationOCI is a proper OCI runtime.
    IsolationOCI
    // IsolationChroot is a more chroot-like environment: less isolation,
    // but with fewer requirements.
    IsolationChroot
    // IsolationOCIRootless is a proper OCI runtime in rootless mode.
    IsolationOCIRootless
)

func (Isolation) String Uses

func (i Isolation) String() string

String converts a Isolation into a string.

type NamespaceOption Uses

type NamespaceOption struct {
    // Name specifies the type of namespace, typically matching one of the
    // ...Namespace constants defined in
    // github.com/opencontainers/runtime-spec/specs-go.
    Name string
    // Host is used to force our processes to use the host's namespace of
    // this type.
    Host bool
    // Path is the path of the namespace to attach our process to, if Host
    // is not set.  If Host is not set and Path is also empty, a new
    // namespace will be created for the process that we're starting.
    // If Name is specs.NetworkNamespace, if Path doesn't look like an
    // absolute path, it is treated as a comma-separated list of CNI
    // configuration names which will be selected from among all of the CNI
    // network configurations which we find.
    Path string
}

NamespaceOption controls how we set up a namespace when launching processes.

type NamespaceOptions Uses

type NamespaceOptions []NamespaceOption

NamespaceOptions provides some helper methods for a slice of NamespaceOption structs.

func DefaultNamespaceOptions Uses

func DefaultNamespaceOptions() (NamespaceOptions, error)

DefaultNamespaceOptions returns the default namespace settings from the runtime-tools generator library.

func (*NamespaceOptions) AddOrReplace Uses

func (n *NamespaceOptions) AddOrReplace(options ...NamespaceOption)

AddOrReplace either adds or replaces the configuration for a given namespace.

func (*NamespaceOptions) Find Uses

func (n *NamespaceOptions) Find(namespace string) *NamespaceOption

Find the configuration for the namespace of the given type. If there are duplicates, find the _last_ one of the type, since we assume it was appended more recently.

type NetworkConfigurationPolicy Uses

type NetworkConfigurationPolicy int

NetworkConfigurationPolicy takes the value NetworkDefault, NetworkDisabled, or NetworkEnabled.

const (
    // NetworkDefault is one of the values that BuilderOptions.ConfigureNetwork
    // can take, signalling that the default behavior should be used.
    NetworkDefault NetworkConfigurationPolicy = iota
    // NetworkDisabled is one of the values that BuilderOptions.ConfigureNetwork
    // can take, signalling that network interfaces should NOT be configured for
    // newly-created network namespaces.
    NetworkDisabled
    // NetworkEnabled is one of the values that BuilderOptions.ConfigureNetwork
    // can take, signalling that network interfaces should be configured for
    // newly-created network namespaces.
    NetworkEnabled
)

func (NetworkConfigurationPolicy) String Uses

func (p NetworkConfigurationPolicy) String() string

String formats a NetworkConfigurationPolicy as a string.

type PullOptions Uses

type PullOptions struct {
    // SignaturePolicyPath specifies an override location for the signature
    // policy which should be used for verifying the new image as it is
    // being written.  Except in specific circumstances, no value should be
    // specified, indicating that the shared, system-wide default policy
    // should be used.
    SignaturePolicyPath string
    // ReportWriter is an io.Writer which will be used to log the writing
    // of the new image.
    ReportWriter io.Writer
    // Store is the local storage store which holds the source image.
    Store storage.Store
    // github.com/containers/image/types SystemContext to hold credentials
    // and other authentication/authorization information.
    SystemContext *types.SystemContext
    // Transport is a value which is prepended to the image's name, if the
    // image name alone can not be resolved to a reference to a source
    // image.  No separator is implicitly added.
    Transport string
}

PullOptions can be used to alter how an image is copied in from somewhere.

type PullPolicy Uses

type PullPolicy int

PullPolicy takes the value PullIfMissing, PullAlways, or PullNever.

const (
    // PullIfMissing is one of the values that BuilderOptions.PullPolicy
    // can take, signalling that the source image should be pulled from a
    // registry if a local copy of it is not already present.
    PullIfMissing PullPolicy = iota
    // PullAlways is one of the values that BuilderOptions.PullPolicy can
    // take, signalling that a fresh, possibly updated, copy of the image
    // should be pulled from a registry before the build proceeds.
    PullAlways
    // PullNever is one of the values that BuilderOptions.PullPolicy can
    // take, signalling that the source image should not be pulled from a
    // registry if a local copy of it is not already present.
    PullNever
)

func (PullPolicy) String Uses

func (p PullPolicy) String() string

String converts a PullPolicy into a string.

type PushOptions Uses

type PushOptions struct {
    // Compression specifies the type of compression which is applied to
    // layer blobs.  The default is to not use compression, but
    // archive.Gzip is recommended.
    Compression archive.Compression
    // SignaturePolicyPath specifies an override location for the signature
    // policy which should be used for verifying the new image as it is
    // being written.  Except in specific circumstances, no value should be
    // specified, indicating that the shared, system-wide default policy
    // should be used.
    SignaturePolicyPath string
    // ReportWriter is an io.Writer which will be used to log the writing
    // of the new image.
    ReportWriter io.Writer
    // Store is the local storage store which holds the source image.
    Store storage.Store
    // github.com/containers/image/types SystemContext to hold credentials
    // and other authentication/authorization information.
    SystemContext *types.SystemContext
    // ManifestType is the format to use when saving the imge using the 'dir' transport
    // possible options are oci, v2s1, and v2s2
    ManifestType string
}

PushOptions can be used to alter how an image is copied somewhere.

type RunOptions Uses

type RunOptions struct {
    // Hostname is the hostname we set for the running container.
    Hostname string
    // Isolation is either IsolationDefault, IsolationOCI, IsolationChroot, or IsolationOCIRootless.
    Isolation Isolation
    // Runtime is the name of the runtime to run.  It should accept the
    // same arguments that runc does, and produce similar output.
    Runtime string
    // Args adds global arguments for the runtime.
    Args []string
    // NoPivot adds the --no-pivot runtime flag.
    NoPivot bool
    // Mounts are additional mount points which we want to provide.
    Mounts []specs.Mount
    // Env is additional environment variables to set.
    Env []string
    // User is the user as whom to run the command.
    User string
    // WorkingDir is an override for the working directory.
    WorkingDir string
    // Shell is default shell to run in a container.
    Shell string
    // Cmd is an override for the configured default command.
    Cmd []string
    // Entrypoint is an override for the configured entry point.
    Entrypoint []string
    // NamespaceOptions controls how we set up the namespaces for the process.
    NamespaceOptions NamespaceOptions
    // ConfigureNetwork controls whether or not network interfaces and
    // routing are configured for a new network namespace (i.e., when not
    // joining another's namespace and not just using the host's
    // namespace), effectively deciding whether or not the process has a
    // usable network.
    ConfigureNetwork NetworkConfigurationPolicy
    // CNIPluginPath is the location of CNI plugin helpers, if they should be
    // run from a location other than the default location.
    CNIPluginPath string
    // CNIConfigDir is the location of CNI configuration files, if the files in
    // the default configuration directory shouldn't be used.
    CNIConfigDir string
    // Terminal provides a way to specify whether or not the command should
    // be run with a pseudoterminal.  By default (DefaultTerminal), a
    // terminal is used if os.Stdout is connected to a terminal, but that
    // decision can be overridden by specifying either WithTerminal or
    // WithoutTerminal.
    Terminal TerminalPolicy
    // TerminalSize provides a way to set the number of rows and columns in
    // a pseudo-terminal, if we create one, and Stdin/Stdout/Stderr aren't
    // connected to a terminal.
    TerminalSize *specs.Box
    // The stdin/stdout/stderr descriptors to use.  If set to nil, the
    // corresponding files in the "os" package are used as defaults.
    Stdin  io.Reader `json:"-"`
    Stdout io.Writer `json:"-"`
    Stderr io.Writer `json:"-"`
    // Quiet tells the run to turn off output to stdout.
    Quiet bool
    // AddCapabilities is a list of capabilities to add to the default set.
    AddCapabilities []string
    // DropCapabilities is a list of capabilities to remove from the default set,
    // after processing the AddCapabilities set.  If a capability appears in both
    // lists, it will be dropped.
    DropCapabilities []string
}

RunOptions can be used to alter how a command is run in the container.

type TerminalPolicy Uses

type TerminalPolicy int

TerminalPolicy takes the value DefaultTerminal, WithoutTerminal, or WithTerminal.

const (
    // DefaultTerminal indicates that this Run invocation should be
    // connected to a pseudoterminal if we're connected to a terminal.
    DefaultTerminal TerminalPolicy = iota
    // WithoutTerminal indicates that this Run invocation should NOT be
    // connected to a pseudoterminal.
    WithoutTerminal
    // WithTerminal indicates that this Run invocation should be connected
    // to a pseudoterminal.
    WithTerminal
)

func (TerminalPolicy) String Uses

func (t TerminalPolicy) String() string

String converts a TerminalPoliicy into a string.

Package buildah imports 61 packages (graph). Updated 2019-10-17. Refresh now. Tools for package owners. This is a quick bug-fix fork (has fewer than three commits, and only during the week it was created).