Documentation ¶
Index ¶
- Constants
- func AddImageNames(store storage.Store, image *storage.Image, addNames []string) error
- func ExpandNames(names []string) ([]string, error)
- func InitReexec() bool
- func Push(image string, dest types.ImageReference, options PushOptions) error
- type Builder
- func (b *Builder) AddVolume(v string)
- func (b *Builder) Annotations() map[string]string
- func (b *Builder) Architecture() string
- func (b *Builder) ClearAnnotations()
- func (b *Builder) ClearEnv()
- func (b *Builder) ClearLabels()
- func (b *Builder) ClearPorts()
- func (b *Builder) ClearVolumes()
- func (b *Builder) Cmd() []string
- func (b *Builder) Comment() string
- func (b *Builder) Commit(dest types.ImageReference, options CommitOptions) error
- func (b *Builder) CreatedBy() string
- func (b *Builder) Domainname() string
- func (b *Builder) Entrypoint() []string
- func (b *Builder) Env() []string
- func (b *Builder) Hostname() string
- func (b *Builder) Labels() map[string]string
- func (b *Builder) Maintainer() string
- func (b *Builder) OS() string
- func (b *Builder) Ports() []string
- func (b *Builder) RemoveVolume(v string)
- func (b *Builder) Save() error
- func (b *Builder) SetAnnotation(key, value string)
- func (b *Builder) SetArchitecture(arch string)
- func (b *Builder) SetCmd(cmd []string)
- func (b *Builder) SetComment(comment string)
- func (b *Builder) SetCreatedBy(how string)
- func (b *Builder) SetDefaultMountsFilePath(path string)
- func (b *Builder) SetDomainname(name string)
- func (b *Builder) SetEntrypoint(ep []string)
- func (b *Builder) SetEnv(k string, v string)
- func (b *Builder) SetHostname(name string)
- func (b *Builder) SetLabel(k string, v string)
- func (b *Builder) SetMaintainer(who string)
- func (b *Builder) SetOS(os string)
- func (b *Builder) SetPort(p string)
- func (b *Builder) SetShell(shell []string)
- func (b *Builder) SetStopSignal(stopSignal string)
- func (b *Builder) SetUser(spec string)
- func (b *Builder) SetWorkDir(there string)
- func (b *Builder) Shell() []string
- func (b *Builder) StopSignal() string
- func (b *Builder) UnsetAnnotation(key string)
- func (b *Builder) UnsetEnv(k string)
- func (b *Builder) UnsetLabel(k string)
- func (b *Builder) UnsetPort(p string)
- func (b *Builder) User() string
- func (b *Builder) Volumes() []string
- func (b *Builder) WorkDir() string
- type CommitOptions
- type CommonBuildOptions
- type ImportOptions
- type PushOptions
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 = "0.15" )
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 = docker.V2S2MediaTypeManifest )
Variables ¶
This section is empty.
Functions ¶
func AddImageNames ¶
AddImageNames adds the specified names to the specified image.
func ExpandNames ¶
ExpandNames takes unqualified names, parses them as image names, and returns the fully expanded result, including a tag. Names which don't include a registry name will be marked for the most-preferred registry (i.e., the first one in our configuration).
func InitReexec ¶
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 Push ¶
func Push(image string, dest types.ImageReference, options PushOptions) error
Push copies the contents of the image to a new location.
Types ¶
type Builder ¶
type Builder struct { // 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"` // 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"` CommonBuildOpts *CommonBuildOptions // 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 ¶
func ImportBuilder(store storage.Store, options ImportOptions) (*Builder, error)
ImportBuilder creates a new build configuration using an already-present container.
func (*Builder) AddVolume ¶
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 ¶
Annotations returns a set of key-value pairs from the image's manifest.
func (*Builder) Architecture ¶
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 ¶
func (b *Builder) ClearAnnotations()
ClearAnnotations removes all keys and their values from the image's manifest.
func (*Builder) ClearEnv ¶
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 ¶
func (b *Builder) ClearLabels()
ClearLabels removes all keys and their values from the image's runtime configuration.
func (*Builder) ClearPorts ¶
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 ¶
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 ¶
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 ¶
Comment returns the comment which will be set in the container and in containers built using images buiilt from the container
func (*Builder) Commit ¶
func (b *Builder) Commit(dest types.ImageReference, options CommitOptions) 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.
func (*Builder) Domainname ¶
Domainname returns the domainname which will be set in the container and in containers built using images built from the container.
func (*Builder) Entrypoint ¶
Entrypoint returns the command to be run for containers built from images built from this container.
func (*Builder) Env ¶
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) Hostname ¶
Hostname returns the hostname which will be set in the container and in containers built using images built from the container.
func (*Builder) Labels ¶
Labels returns a set of key-value pairs from the image's runtime configuration.
func (*Builder) Maintainer ¶
Maintainer returns contact information for the person who built the image.
func (*Builder) OS ¶
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) Ports ¶
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 ¶
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) Save ¶
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 ¶
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 ¶
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 ¶
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 ¶
SetComment sets the Comment which will be set in the container and in containers built using images built from the container.
func (*Builder) SetCreatedBy ¶
SetCreatedBy sets the description of how this image was built.
func (*Builder) SetDefaultMountsFilePath ¶
SetDefaultMountsFilePath sets the mounts file path for testing purposes
func (*Builder) SetDomainname ¶
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 ¶
SetEntrypoint sets the command to be run for in containers built from images built from this container.
func (*Builder) SetEnv ¶
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) SetHostname ¶
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 ¶
SetLabel adds or overwrites a key's value from the image's runtime configuration.
func (*Builder) SetMaintainer ¶
SetMaintainer sets contact information for the person who built the image.
func (*Builder) SetOS ¶
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) SetPort ¶
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 ¶
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 ¶
SetStopSignal sets the signal which will be set in the container and in containers built using images built from the container.
func (*Builder) SetUser ¶
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 ¶
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 ¶
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 ¶
StopSignal returns the signal which will be set in the container and in containers built using images buiilt from the container
func (*Builder) UnsetAnnotation ¶
UnsetAnnotation removes a key and its value from the image's manifest, if it's present.
func (*Builder) UnsetEnv ¶
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 ¶
UnsetLabel removes a key and its value from the image's runtime configuration, if it's present.
func (*Builder) UnsetPort ¶
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 ¶
User returns information about the user as whom the container, or a container built using an image built from this container, should be run.
type CommitOptions ¶
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 }
CommitOptions can be used to alter how an image is committed.
type CommonBuildOptions ¶
type CommonBuildOptions struct { // AddHost is the list of hostnames to add to the resolv.conf AddHost []string //CgroupParent it 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 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 limit Memory int64 //MemorySwap limit value equal to memory plus swap. MemorySwap int64 //SecruityOpts modify the way container security is running LabelOpts []string SeccompProfilePath string ApparmorProfile string //ShmSize is the shared memory size ShmSize string //Ulimit options Ulimit []string //Volumes to bind mount into the container Volumes []string }
CommonBuildOptions are reseources that can be defined by flags for both buildah from and bud
type ImportOptions ¶
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 PushOptions ¶
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.