.nh .TH buildah-build "1" "April 2017" "buildah" .SH NAME .PP buildah-build - Build an image using instructions from Containerfiles .SH SYNOPSIS .PP \fBbuildah build\fP [\fIoptions\fP] [\fIcontext\fP] .PP \fBbuildah bud\fP [\fIoptions\fP] [\fIcontext\fP] .SH DESCRIPTION .PP Builds an image using instructions from one or more Containerfiles or Dockerfiles and a specified build context directory. A Containerfile uses the same syntax as a Dockerfile internally. For this document, a file referred to as a Containerfile can be a file named either 'Containerfile' or 'Dockerfile'. .PP The build context directory can be specified as the http(s) URL of an archive, git repository or Containerfile. .PP If no context directory is specified, then Buildah will assume the current working directory as build context, which should contain a Containerfile. .PP Containerfiles ending with a ".in" suffix will be preprocessed via cpp(1). This can be useful to decompose Containerfiles into several reusable parts that can be used via CPP's \fB#include\fP directive. Notice, a Containerfile.in file can still be used by other tools when manually preprocessing them via \fBcpp -E\fR\&. Any comments ( Lines beginning with \fB#\fR ) in included Containerfile(s) that are not preprocess commands, will be printed as warnings during builds. .PP When the URL is an archive, the contents of the URL is downloaded to a temporary location and extracted before execution. .PP When the URL is a Containerfile, the file is downloaded to a temporary location. .PP When a Git repository is set as the URL, the repository is cloned locally and then used as the build context. A non-default branch (or commit ID) and subdirectory of the cloned git repository can be used by including their names at the end of the URL in the form \fBmyrepo.git#mybranch:subdir\fR, \fBmyrepo.git#mycommit:subdir\fR, or \fBmyrepo.git#:subdir\fR if the subdirectory should be used from the default branch. .SH OPTIONS .PP \fB--add-host\fP=[] .PP Add a custom host-to-IP mapping (host:ip) .PP Add a line to /etc/hosts. The format is hostname:ip. The \fB--add-host\fP option can be set multiple times. Conflicts with the --no-hosts option. .PP \fB--all-platforms\fP .PP Instead of building for a set of platforms specified using the \fB--platform\fP option, inspect the build's base images, and build for all of the platforms for which they are all available. Stages that use \fIscratch\fP as a starting point can not be inspected, so at least one non-\fIscratch\fP stage must be present for detection to work usefully. .PP \fB--annotation\fP \fIannotation[=value]\fP .PP Add an image \fIannotation\fP (e.g. annotation=\fIvalue\fP) to the image metadata. Can be used multiple times. If \fIannotation\fP is named, but neither \fB=\fR nor a \fBvalue\fR is provided, then the \fIannotation\fP is set to an empty value. .PP Note: this information is not present in Docker image formats, so it is discarded when writing images in Docker formats. .PP \fB--arch\fP="ARCH" .PP Set the ARCH of the image to be built, and that of the base image to be pulled, if the build uses one, to the provided value instead of using the architecture of the host. (Examples: arm, arm64, 386, amd64, ppc64le, s390x) .PP \fB--authfile\fP \fIpath\fP .PP Path of the authentication file. Default is ${XDG_\\RUNTIME_DIR}/containers/auth.json. If XDG_RUNTIME_DIR is not set, the default is /run/containers/$UID/auth.json. This file is created using \fBbuildah login\fR\&. .PP If the authorization state is not found there, $HOME/.docker/config.json is checked, which is set using \fBdocker login\fR\&. .PP Note: You can also override the default path of the authentication file by setting the REGISTRY_AUTH_FILE environment variable. \fBexport REGISTRY_AUTH_FILE=path\fR .PP \fB--build-arg\fP \fIarg=value\fP .PP Specifies a build argument and its value, which will be interpolated in instructions read from the Containerfiles in the same way that environment variables are, but which will not be added to environment variable list in the resulting image's configuration. .PP Please refer to the BUILD TIME VARIABLES \[la]#build\-time\-variables\[ra] section for the list of variables that can be overridden within the Containerfile at run time. .PP \fB--build-arg-file\fP \fIpath\fP .PP Specifies a file containing lines of build arguments of the form arg=value. The suggested file name is argfile.conf. .PP Comment lines beginning with \fB#\fR are ignored, along with blank lines. All others should be of the \fBarg=value\fR format passed to \fB--build-arg\fR\&. .PP If several arguments are provided via the \fB--build-arg-file\fR and \fB--build-arg\fR options, the build arguments will be merged across all of the provided files and command line arguments. .PP Any file provided in a \fB--build-arg-file\fR option will be read before the arguments supplied via the \fB--build-arg\fR option. .PP When a given argument name is specified several times, the last instance is the one that is passed to the resulting builds. This means \fB--build-arg\fR values always override those in a \fB--build-arg-file\fR\&. .PP \fB--build-context\fP \fIname=value\fP .PP Specify an additional build context using its short name and its location. Additional build contexts can be referenced in the same manner as we access different stages in \fBCOPY\fR instruction. .PP Valid values could be: * Local directory – e.g. --build-context project2=../path/to/project2/src * HTTP URL to a tarball – e.g. --build-context src=https://example.org/releases/src.tar * Container image – specified with a container-image:// prefix, e.g. --build-context alpine=container-image://alpine:3.15, (also accepts docker://, docker-image://) .PP On the Containerfile side, you can reference the build context on all commands that accept the “from” parameter. Here’s how that might look: .EX FROM [name] COPY --from=[name] ... RUN --mount=from=[name] … .EE .PP The value of \fB[name]\fR is matched with the following priority order: .RS .IP \(bu 2 Named build context defined with --build-context [name]=.. .IP \(bu 2 Stage defined with AS [name] inside Containerfile .IP \(bu 2 Image [name], either local or in a remote registry .RE .PP \fB--cache-from\fP .PP Repository to utilize as a potential list of cache sources. When specified, Buildah will try to look for cache images in the specified repositories and will attempt to pull cache images instead of actually executing the build steps locally. Buildah will only attempt to pull previously cached images if they are considered as valid cache hits. .PP Use the \fB--cache-to\fR option to populate a remote repository or repositories with cache content. .PP Example .EX # populate a cache and also consult it buildah build -t test --layers --cache-to registry/myrepo/cache --cache-from registry/myrepo/cache . .EE .PP Note: \fB--cache-from\fR option is ignored unless \fB--layers\fR is specified. .PP Note: Buildah's \fB--cache-from\fR option is designed differently than Docker and BuildKit's \fB--cache-from\fR option. Buildah's distributed cache mechanism pulls intermediate images from the remote registry itself, unlike Docker and BuildKit where the intermediate image is stored in the image itself. Buildah's approach is similar to kaniko, which does not inflate the size of the original image with intermediate images. Also, intermediate images can truly be kept distributed across one or more remote registries using Buildah's caching mechanism. .PP \fB--cache-to\fP .PP Set this flag to specify list of remote repositories that will be used to store cache images. Buildah will attempt to push newly built cache image to the remote repositories. .PP Note: Use the \fB--cache-from\fR option in order to use cache content in a remote repository. .PP Example .EX # populate a cache and also consult it buildah build -t test --layers --cache-to registry/myrepo/cache --cache-from registry/myrepo/cache . .EE .PP Note: \fB--cache-to\fR option is ignored unless \fB--layers\fR is specified. .PP Note: Buildah's \fB--cache-to\fR option is designed differently than Docker and BuildKit's \fB--cache-to\fR option. Buildah's distributed cache mechanism push intermediate images to the remote registry itself, unlike Docker and BuildKit where the intermediate image is stored in the image itself. Buildah's approach is similar to kaniko, which does not inflate the size of the original image with intermediate images. Also, intermediate images can truly be kept distributed across one or more remote registries using Buildah's caching mechanism. .PP \fB--cache-ttl\fP \fIduration\fP .PP Limit the use of cached images to only consider images with created timestamps less than \fIduration\fP ago. For example if \fB--cache-ttl=1h\fR is specified, Buildah will only consider intermediate cache images which are created under the duration of one hour, and intermediate cache images outside this duration will be ignored. .PP Note: Setting \fB--cache-ttl=0\fR manually is equivalent to using \fB--no-cache\fR in the implementation since this would effectively mean that user is not willing to use cache at all. .PP \fB--cap-add\fP=\fICAP_xxx\fP .PP When executing RUN instructions, run the command specified in the instruction with the specified capability added to its capability set. Certain capabilities are granted by default; this option can be used to add more. .PP \fB--cap-drop\fP=\fICAP_xxx\fP .PP When executing RUN instructions, run the command specified in the instruction with the specified capability removed from its capability set. The CAP_CHOWN, CAP_DAC_OVERRIDE, CAP_FOWNER, CAP_FSETID, CAP_KILL, CAP_NET_BIND_SERVICE, CAP_SETFCAP, CAP_SETGID, CAP_SETPCAP, and CAP_SETUID capabilities are granted by default; this option can be used to remove them. The list of default capabilities is managed in containers.conf(5). .PP If a capability is specified to both the \fB--cap-add\fP and \fB--cap-drop\fP options, it will be dropped, regardless of the order in which the options were given. .PP \fB--cert-dir\fP \fIpath\fP .PP Use certificates at \fIpath\fP (*\&.crt, *\&.cert, *\&.key) to connect to the registry. The default certificates directory is \fI/etc/containers/certs.d\fP\&. .PP \fB--cgroup-parent\fP="" .PP Path to cgroups under which the cgroup for the container will be created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups will be created if they do not already exist. .PP \fB--cgroupns\fP \fIhow\fP .PP Sets the configuration for cgroup namespaces when handling \fBRUN\fR instructions. The configured value can be "" (the empty string) or "private" to indicate that a new cgroup namespace should be created, or it can be "host" to indicate that the cgroup namespace in which \fBbuildah\fR itself is being run should be reused. .PP \fB--compress\fP .PP This option is added to be aligned with other containers CLIs. Buildah doesn't send a copy of the context directory to a daemon or a remote server. Thus, compressing the data before sending it is irrelevant to Buildah. .PP \fB--cpp-flag\fP="" .PP Set additional flags to pass to the C Preprocessor cpp(1). Containerfiles ending with a ".in" suffix will be preprocessed via cpp(1). This option can be used to pass additional flags to cpp. Note: You can also set default CPPFLAGS by setting the BUILDAH_CPPFLAGS environment variable (e.g., \fBexport BUILDAH_CPPFLAGS="-DDEBUG"\fR). .PP \fB--cpu-period\fP=\fI0\fP .PP Set the CPU period for the Completely Fair Scheduler (CFS), which is a duration in microseconds. Once the container's CPU quota is used up, it will not be scheduled to run until the current period ends. Defaults to 100000 microseconds. .PP On some systems, changing the CPU limits may not be allowed for non-root users. For more details, see https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error .PP \fB--cpu-quota\fP=\fI0\fP .PP Limit the CPU CFS (Completely Fair Scheduler) quota .PP Limit the container's CPU usage. By default, containers run with the full CPU resource. This flag tells the kernel to restrict the container's CPU usage to the quota you specify. .PP On some systems, changing the CPU limits may not be allowed for non-root users. For more details, see https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error .PP \fB--cpu-shares\fP, \fB-c\fP=\fI0\fP .PP CPU shares (relative weight) .PP By default, all containers get the same proportion of CPU cycles. This proportion can be modified by changing the container's CPU share weighting relative to the weighting of all other running containers. .PP To modify the proportion from the default of 1024, use the \fB--cpu-shares\fP flag to set the weighting to 2 or higher. .PP The proportion will only apply when CPU-intensive processes are running. When tasks in one container are idle, other containers can use the left-over CPU time. The actual amount of CPU time will vary depending on the number of containers running on the system. .PP For example, consider three containers, one has a cpu-share of 1024 and two others have a cpu-share setting of 512. When processes in all three containers attempt to use 100% of CPU, the first container would receive 50% of the total CPU time. If you add a fourth container with a cpu-share of 1024, the first container only gets 33% of the CPU. The remaining containers receive 16.5%, 16.5% and 33% of the CPU. .PP On a multi-core system, the shares of CPU time are distributed over all CPU cores. Even if a container is limited to less than 100% of CPU time, it can use 100% of each individual CPU core. .PP For example, consider a system with more than three cores. If you start one container \fB{C0}\fP with \fB-c=512\fP running one process, and another container \fB{C1}\fP with \fB-c=1024\fP running two processes, this can result in the following division of CPU shares: .EX PID container CPU CPU share 100 {C0} 0 100% of CPU0 101 {C1} 1 100% of CPU1 102 {C1} 2 100% of CPU2 .EE .PP \fB--cpuset-cpus\fP="" .PP CPUs in which to allow execution (0-3, 0,1) .PP \fB--cpuset-mems\fP="" .PP Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. .PP If you have four memory nodes on your system (0-3), use \fB--cpuset-mems=0,1\fR then processes in your container will only use memory from the first two memory nodes. .PP \fB--creds\fP \fIcreds\fP .PP The [username[:password]] to use to authenticate with the registry if required. If one or both values are not supplied, a command line prompt will appear and the value can be entered. The password is entered without echo. .PP \fB--cw\fP \fIoptions\fP .PP Produce an image suitable for use as a confidential workload running in a trusted execution environment (TEE) using krun (i.e., \fIcrun\fP built with the libkrun feature enabled and invoked as \fIkrun\fP). Instead of the conventional contents, the root filesystem of the image will contain an encrypted disk image and configuration information for krun. .PP The value for \fIoptions\fP is a comma-separated list of key=value pairs, supplying configuration information which is needed for producing the additional data which will be included in the container image. .PP Recognized \fIkeys\fP are: .PP \fIattestation_url\fP: The location of a key broker / attestation server. If a value is specified, the new image's workload ID, along with the passphrase used to encrypt the disk image, will be registered with the server, and the server's location will be stored in the container image. At run-time, krun is expected to contact the server to retrieve the passphrase using the workload ID, which is also stored in the container image. If no value is specified, a \fIpassphrase\fP value \fImust\fP be specified. .PP \fIcpus\fP: The number of virtual CPUs which the image expects to be run with at run-time. If not specified, a default value will be supplied. .PP \fIfirmware_library\fP: The location of the libkrunfw-sev shared library. If not specified, \fBbuildah\fR checks for its presence in a number of hard-coded locations. .PP \fImemory\fP: The amount of memory which the image expects to be run with at run-time, as a number of megabytes. If not specified, a default value will be supplied. .PP \fIpassphrase\fP: The passphrase to use to encrypt the disk image which will be included in the container image. If no value is specified, but an \fIattestation_url\fP value is specified, a randomly-generated passphrase will be used. The authors recommend setting an \fIattestation_url\fP but not a \fIpassphrase\fP\&. .PP \fIslop\fP: Extra space to allocate for the disk image compared to the size of the container image's contents, expressed either as a percentage (..%) or a size value (bytes, or larger units if suffixes like KB or MB are present), or a sum of two or more such specifications. If not specified, \fBbuildah\fR guesses that 25% more space than the contents will be enough, but this option is provided in case its guess is wrong. .PP \fItype\fP: The type of trusted execution environment (TEE) which the image should be marked for use with. Accepted values are "SEV" (AMD Secure Encrypted Virtualization - Encrypted State) and "SNP" (AMD Secure Encrypted Virtualization - Secure Nested Paging). If not specified, defaults to "SNP". .PP \fIworkload_id\fP: A workload identifier which will be recorded in the container image, to be used at run-time for retrieving the passphrase which was used to encrypt the disk image. If not specified, a semi-random value will be derived from the base image's image ID. .PP \fB--decryption-key\fP \fIkey[:passphrase]\fP .PP The [key[:passphrase]] to be used for decryption of images. Key can point to keys and/or certificates. Decryption will be tried with all keys. If the key is protected by a passphrase, it is required to be passed in the argument and omitted otherwise. .PP \fB--device\fP=\fIdevice\fP .PP Add a host device to the container. Optional \fIpermissions\fP parameter can be used to specify device permissions, it is combination of \fBr\fP for read, \fBw\fP for write, and \fBm\fP for \fBmknod\fP(2). .PP Example: \fB--device=/dev/sdc:/dev/xvdc:rwm\fP\&. .PP Note: if _host\fIdevice\fP is a symbolic link then it will be resolved first. The container will only store the major and minor numbers of the host device. .PP Note: if the user only has access rights via a group, accessing the device from inside a rootless container will fail. The \fBcrun\fP(1) runtime offers a workaround for this by adding the option \fB--annotation run.oci.keep_original_groups=1\fP\&. .PP \fB--disable-compression\fP, \fB-D\fP .PP Don't compress filesystem layers when building the image unless it is required by the location where the image is being written. This is the default setting, because image layers are compressed automatically when they are pushed to registries, and images being written to local storage would only need to be decompressed again to be stored. Compression can be forced in all cases by specifying \fB--disable-compression=false\fP\&. .PP \fB--disable-content-trust\fP .PP This is a Docker specific option to disable image verification to a Container registry and is not supported by Buildah. This flag is a NOOP and provided solely for scripting compatibility. .PP \fB--dns\fP=[] .PP Set custom DNS servers. Invalid if using \fB--dns\fP with \fB--network=none\fP\&. .PP This option can be used to override the DNS configuration passed to the container. Typically this is necessary when the host DNS configuration is invalid for the container (e.g., 127.0.0.1). When this is the case the \fB--dns\fR flag is necessary for every run. .PP The special value \fBnone\fP can be specified to disable creation of /etc/resolv.conf in the container by Buildah. The /etc/resolv.conf file in the image will be used without changes. .PP \fB--dns-option\fP=[] .PP Set custom DNS options. Invalid if using \fB--dns-option\fP with \fB--network=none\fP\&. .PP \fB--dns-search\fP=[] .PP Set custom DNS search domains. Invalid if using \fB--dns-search\fP with \fB--network=none\fP\&. .PP \fB--env\fP \fIenv[=value]\fP .PP Add a value (e.g. env=\fIvalue\fP) to the built image. Can be used multiple times. If neither \fB=\fR nor a \fB*value*\fR are specified, but \fIenv\fP is set in the current environment, the value from the current environment will be added to the image. The value of \fIenv\fP can be overridden by ENV instructions in the Containerfile. To remove an environment variable from the built image, use the \fB--unsetenv\fR option. .PP \fB--file\fP, \fB-f\fP \fIContainerfile\fP .PP Specifies a Containerfile which contains instructions for building the image, either a local file or an \fBhttp\fP or \fBhttps\fP URL. If more than one Containerfile is specified, \fIFROM\fP instructions will only be accepted from the last specified file. .PP If a local file is specified as the Containerfile and it does not exist, the context directory will be prepended to the local file value. .PP If you specify \fB-f -\fR, the Containerfile contents will be read from stdin. .PP \fB--force-rm\fP \fIbool-value\fP .PP Always remove intermediate containers after a build, even if the build fails (default false). .PP \fB--format\fP .PP Control the format for the built image's manifest and configuration data. Recognized formats include \fIoci\fP (OCI image-spec v1.0, the default) and \fIdocker\fP (version 2, using schema format 2 for the manifest). .PP Note: You can also override the default format by setting the BUILDAH_FORMAT environment variable. \fBexport BUILDAH_FORMAT=docker\fR .PP \fB--from\fP .PP Overrides the first \fBFROM\fR instruction within the Containerfile. If there are multiple FROM instructions in a Containerfile, only the first is changed. .PP \fB--group-add\fP=\fIgroup\fP | \fIkeep-groups\fP .PP Assign additional groups to the primary user running within the container process. .RS .IP \(bu 2 \fBkeep-groups\fR is a special flag that tells Buildah to keep the supplementary group access. .RE .PP Allows container to use the user's supplementary group access. If file systems or devices are only accessible by the rootless user's group, this flag tells the OCI runtime to pass the group access into the container. Currently only available with the \fBcrun\fR OCI runtime. Note: \fBkeep-groups\fR is exclusive, other groups cannot be specified with this flag. .PP \fB--help\fP, \fB-h\fP .PP Print usage statement .PP \fB--hooks-dir\fP \fIpath\fP .PP Each \fB*.json\fR file in the path configures a hook for buildah build containers. For more details on the syntax of the JSON files and the semantics of hook injection, see oci-hooks(5). Buildah currently support both the 1.0.0 and 0.1.0 hook schemas, although the 0.1.0 schema is deprecated. .PP This option may be set multiple times; paths from later options have higher precedence (oci-hooks(5) discusses directory precedence). .PP For the annotation conditions, buildah uses any annotations set in the generated OCI configuration. .PP For the bind-mount conditions, only mounts explicitly requested by the caller via --volume are considered. Bind mounts that buildah inserts by default (e.g. /dev/shm) are not considered. .PP If --hooks-dir is unset for root callers, Buildah will currently default to /usr/share/containers/oci/hooks.d and /etc/containers/oci/hooks.d in order of increasing precedence. Using these defaults is deprecated, and callers should migrate to explicitly setting --hooks-dir. .PP \fB--http-proxy\fP=true .PP By default proxy environment variables are passed into the container if set for the buildah process. This can be disabled by setting the \fB--http-proxy\fR option to \fBfalse\fR\&. The environment variables passed in include \fBhttp_proxy\fR, \fBhttps_proxy\fR, \fBftp_proxy\fR, \fBno_proxy\fR, and also the upper case versions of those. .PP \fB--identity-label\fP \fIbool-value\fP .PP Adds default identity label \fBio.buildah.version\fR if set. (default true). .PP \fB--ignorefile\fP \fIfile\fP .PP Path to an alternative .containerignore (.dockerignore) file. .PP \fB--iidfile\fP \fIImageIDfile\fP .PP Write the built image's ID to the file. When \fB--platform\fR is specified more than once, attempting to use this option will trigger an error. .PP \fB--ipc\fP \fIhow\fP .PP Sets the configuration for IPC namespaces when handling \fBRUN\fR instructions. The configured value can be "" (the empty string) or "container" to indicate that a new IPC namespace should be created, or it can be "host" to indicate that the IPC namespace in which \fBbuildah\fR itself is being run should be reused, or it can be the path to an IPC namespace which is already in use by another process. .PP \fB--isolation\fP \fItype\fP .PP Controls what type of isolation is used for running processes as part of \fBRUN\fR instructions. Recognized types include \fIoci\fP (OCI-compatible runtime, the default), \fIrootless\fP (OCI-compatible runtime invoked using a modified configuration, with \fI--no-new-keyring\fP added to its \fIcreate\fP invocation, reusing the host's network and UTS namespaces, and creating private IPC, PID, mount, and user namespaces; the default for unprivileged users), and \fIchroot\fP (an internal wrapper that leans more toward chroot(1) than container technology, reusing the host's control group, network, IPC, and PID namespaces, and creating private mount and UTS namespaces, and creating user namespaces only when they're required for ID mapping). .PP Note: You can also override the default isolation type by setting the BUILDAH_ISOLATION environment variable. \fBexport BUILDAH_ISOLATION=oci\fR .PP \fB--jobs\fP \fIN\fP .PP Run up to N concurrent stages in parallel. If the number of jobs is greater than 1, stdin will be read from /dev/null. If 0 is specified, then there is no limit on the number of jobs that run in parallel. .PP \fB--label\fP \fIlabel[=value]\fP .PP Add an image \fIlabel\fP (e.g. label=\fIvalue\fP) to the image metadata. Can be used multiple times. If \fIlabel\fP is named, but neither \fB=\fR nor a \fBvalue\fR is provided, then the \fIlabel\fP is set to an empty value. .PP Users can set a special LABEL \fBio.containers.capabilities=CAP1,CAP2,CAP3\fP in a Containerfile that specifies the list of Linux capabilities required for the container to run properly. This label specified in a container image tells container engines, like Podman, to run the container with just these capabilities. The container engine launches the container with just the specified capabilities, as long as this list of capabilities is a subset of the default list. .PP If the specified capabilities are not in the default set, container engines should print an error message and will run the container with the default capabilities. .PP \fB--layer-label\fP \fIlabel[=value]\fP .PP Add an intermediate image \fIlabel\fP (e.g. label=\fIvalue\fP) to the intermediate image metadata. It can be used multiple times. If \fIlabel\fP is named, but neither \fB=\fR nor a \fBvalue\fR is provided, then the \fIlabel\fP is set to an empty value. .PP \fB--layers\fP \fIbool-value\fP .PP Cache intermediate images during the build process (Default is \fBfalse\fR). .PP Note: You can also override the default value of layers by setting the BUILDAH_LAYERS environment variable. \fBexport BUILDAH_LAYERS=true\fR .PP \fB--logfile\fP \fIfilename\fP .PP Log output which would be sent to standard output and standard error to the specified file instead of to standard output and standard error. .PP \fB--logsplit\fP \fIbool-value\fP .PP If --logfile and --platform is specified following flag allows end-users to split log file for each platform into different files with naming convention as \fB${logfile}_${platform-os}_${platform-arch}\fR\&. .PP \fB--manifest\fP \fIlistName\fP .PP Name of the manifest list to which the built image will be added. Creates the manifest list if it does not exist. This option is useful for building multi architecture images. If \fIlistName\fP does not include a registry name component, the registry name \fIlocalhost\fP will be prepended to the list name. .PP \fB--memory\fP, \fB-m\fP="" .PP Memory limit (format: [], where unit = b, k, m or g) .PP Allows you to constrain the memory available to a container. If the host supports swap memory, then the \fB-m\fP memory setting can be larger than physical RAM. If a limit of 0 is specified (not using \fB-m\fP), the container's memory is not limited. The actual limit may be rounded up to a multiple of the operating system's page size (the value would be very large, that's millions of trillions). .PP \fB--memory-swap\fP="LIMIT" .PP A limit value equal to memory plus swap. Must be used with the \fB-m\fP (\fB--memory\fP) flag. The swap \fBLIMIT\fR should always be larger than \fB-m\fP (\fB--memory\fP) value. By default, the swap \fBLIMIT\fR will be set to double the value of --memory. .PP The format of \fBLIMIT\fR is \fB[]\fR\&. Unit can be \fBb\fR (bytes), \fBk\fR (kilobytes), \fBm\fR (megabytes), or \fBg\fR (gigabytes). If you don't specify a unit, \fBb\fR is used. Set LIMIT to \fB-1\fR to enable unlimited swap. .PP \fB--network\fP, \fB--net\fP=\fImode\fP .PP Sets the configuration for network namespaces when handling \fBRUN\fR instructions. .PP Valid \fImode\fP values are: .RS .IP \(bu 2 \fBnone\fP: no networking. Invalid if using \fB--dns\fP, \fB--dns-opt\fP, or \fB--dns-search\fP; .IP \(bu 2 \fBhost\fP: use the host network stack. Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure; .IP \(bu 2 \fBns:\fP\fIpath\fP: path to a network namespace to join; .IP \(bu 2 \fBprivate\fP: create a new namespace for the container (default) .IP \(bu 2 \fB\fP: Join the network with the given name or ID, e.g. use \fB--network mynet\fR to join the network with the name mynet. Only supported for rootful users. .IP \(bu 2 \fBslirp4netns[:OPTIONS,...]\fP: use \fBslirp4netns\fP(1) to create a user network stack. This is the default for rootless containers. It is possible to specify these additional options, they can also be set with \fBnetwork_cmd_options\fR in containers.conf: .RS .IP \(bu 2 \fBallow_host_loopback=true|false\fP: Allow slirp4netns to reach the host loopback IP (default is 10.0.2.2 or the second IP from slirp4netns cidr subnet when changed, see the cidr option below). The default is false. .IP \(bu 2 \fBmtu=MTU\fP: Specify the MTU to use for this network. (Default is \fB65520\fR). .IP \(bu 2 \fBcidr=CIDR\fP: Specify ip range to use for this network. (Default is \fB10.0.2.0/24\fR). .IP \(bu 2 \fBenable_ipv6=true|false\fP: Enable IPv6. Default is true. (Required for \fBoutbound_addr6\fR). .IP \(bu 2 \fBoutbound_addr=INTERFACE\fP: Specify the outbound interface slirp binds to (ipv4 traffic only). .IP \(bu 2 \fBoutbound_addr=IPv4\fP: Specify the outbound ipv4 address slirp binds to. .IP \(bu 2 \fBoutbound_addr6=INTERFACE\fP: Specify the outbound interface slirp binds to (ipv6 traffic only). .IP \(bu 2 \fBoutbound_addr6=IPv6\fP: Specify the outbound ipv6 address slirp binds to. .RE .IP \(bu 2 \fBpasta[:OPTIONS,...]\fP: use \fBpasta\fP(1) to create a user-mode networking stack. .br This is only supported in rootless mode. .br By default, IPv4 and IPv6 addresses and routes, as well as the pod interface name, are copied from the host. If port forwarding isn't configured, ports are forwarded dynamically as services are bound on either side (init namespace or container namespace). Port forwarding preserves the original source IP address. Options described in pasta(1) can be specified as comma-separated arguments. .br In terms of pasta(1) options, \fB--config-net\fP is given by default, in order to configure networking when the container is started, and \fB--no-map-gw\fP is also assumed by default, to avoid direct access from container to host using the gateway address. The latter can be overridden by passing \fB--map-gw\fP in the pasta-specific options (despite not being an actual pasta(1) option). .br Also, \fB-t none\fP and \fB-u none\fP are passed to disable automatic port forwarding based on bound ports. Similarly, \fB-T none\fP and \fB-U none\fP are given to disable the same functionality from container to host. .br Some examples: .RS .IP \(bu 2 \fBpasta:--map-gw\fP: Allow the container to directly reach the host using the gateway address. .IP \(bu 2 \fBpasta:--mtu,1500\fP: Specify a 1500 bytes MTU for the \fItap\fP interface in the container. .IP \(bu 2 \fBpasta:--ipv4-only,-a,10.0.2.0,-n,24,-g,10.0.2.2,--dns-forward,10.0.2.3,-m,1500,--no-ndp,--no-dhcpv6,--no-dhcp\fP, equivalent to default slirp4netns(1) options: disable IPv6, assign \fB10.0.2.0/24\fR to the \fBtap0\fR interface in the container, with gateway \fB10.0.2.3\fR, enable DNS forwarder reachable at \fB10.0.2.3\fR, set MTU to 1500 bytes, disable NDP, DHCPv6 and DHCP support. .IP \(bu 2 \fBpasta:-I,tap0,--ipv4-only,-a,10.0.2.0,-n,24,-g,10.0.2.2,--dns-forward,10.0.2.3,--no-ndp,--no-dhcpv6,--no-dhcp\fP, equivalent to default slirp4netns(1) options with Podman overrides: same as above, but leave the MTU to 65520 bytes .IP \(bu 2 \fBpasta:-t,auto,-u,auto,-T,auto,-U,auto\fP: enable automatic port forwarding based on observed bound ports from both host and container sides .IP \(bu 2 \fBpasta:-T,5201\fP: enable forwarding of TCP port 5201 from container to host, using the loopback interface instead of the tap interface for improved performance .RE .RE .PP \fB--no-cache\fP .PP Do not use existing cached images for the container build. Build from the start with a new set of cached layers. .PP \fB--no-hostname\fP .PP Do not create the \fI/etc/hostname\fP file in the container for RUN instructions. .PP By default, Buildah manages the \fI/etc/hostname\fP file, adding the container's own hostname. When the \fB--no-hostname\fP option is set, the image's \fI/etc/hostname\fP will be preserved unmodified if it exists. .PP \fB--no-hosts\fP .PP Do not create the \fI/etc/hosts\fP file in the container for RUN instructions. .PP By default, Buildah manages \fI/etc/hosts\fP, adding the container's own IP address. \fB--no-hosts\fP disables this, and the image's \fI/etc/hosts\fP will be preserved unmodified. Conflicts with the --add-host option. .PP \fB--omit-history\fP \fIbool-value\fP .PP Omit build history information in the built image. (default false). .PP This option is useful for the cases where end users explicitly want to set \fB--omit-history\fR to omit the optional \fBHistory\fR from built images or when working with images built using build tools that do not include \fBHistory\fR information in their images. .PP \fB--os\fP="OS" .PP Set the OS of the image to be built, and that of the base image to be pulled, if the build uses one, instead of using the current operating system of the host. .PP \fB--os-feature\fP \fIfeature\fP .PP Set the name of a required operating system \fIfeature\fP for the image which will be built. By default, if the image is not based on \fIscratch\fP, the base image's required OS feature list is kept, if the base image specified any. This option is typically only meaningful when the image's OS is Windows. .PP If \fIfeature\fP has a trailing \fB-\fR, then the \fIfeature\fP is removed from the set of required features which will be listed in the image. .PP \fB--os-version\fP \fIversion\fP .PP Set the exact required operating system \fIversion\fP for the image which will be built. By default, if the image is not based on \fIscratch\fP, the base image's required OS version is kept, if the base image specified one. This option is typically only meaningful when the image's OS is Windows, and is typically set in Windows base images, so using this option is usually unnecessary. .PP \fB--output\fP, \fB-o\fP="" .PP Output destination (format: type=local,dest=path) .PP The --output (or -o) option extends the default behavior of building a container image by allowing users to export the contents of the image as files on the local filesystem, which can be useful for generating local binaries, code generation, etc. .PP The value for --output is a comma-separated sequence of key=value pairs, defining the output type and options. .PP Supported \fIkeys\fP are: - \fBdest\fP: Destination path for exported output. Valid value is absolute or relative path, \fB-\fR means the standard output. - \fBtype\fP: Defines the type of output to be used. Valid values is documented below. .PP Valid \fItype\fP values are: - \fBlocal\fP: write the resulting build files to a directory on the client-side. - \fBtar\fP: write the resulting files as a single tarball (.tar). .PP If no type is specified, the value defaults to \fBlocal\fP\&. Alternatively, instead of a comma-separated sequence, the value of \fB--output\fP can be just a destination (in the \fB**dest** format) (e.g.\fR--output some-path\fB,\fR--output -\fB) where\fR--output some-path\fBis treated as if **type=local** and\fR--output -` is treated as if \fBtype=tar\fP\&. .PP \fB--pid\fP \fIhow\fP .PP Sets the configuration for PID namespaces when handling \fBRUN\fR instructions. The configured value can be "" (the empty string) or "private" to indicate that a new PID namespace should be created, or it can be "host" to indicate that the PID namespace in which \fBbuildah\fR itself is being run should be reused, or it can be the path to a PID namespace which is already in use by another process. .PP \fB--platform\fP="OS/ARCH[/VARIANT]" .PP Set the OS/ARCH of the built image (and its base image, if your build uses one) to the provided value instead of using the current operating system and architecture of the host (for example \fBlinux/arm\fR, \fBlinux/arm64\fR, \fBlinux/amd64\fR). .PP The \fB--platform\fR flag can be specified more than once, or given a comma-separated list of values as its argument. When more than one platform is specified, the \fB--manifest\fR option should be used instead of the \fB--tag\fR option. .PP OS/ARCH pairs are those used by the Go Programming Language. In several cases the ARCH value for a platform differs from one produced by other tools such as the \fBarch\fR command. Valid OS and architecture name combinations are listed as values for $GOOS and $GOARCH at https://golang.org/doc/install/source#environment, and can also be found by running \fBgo tool dist list\fR\&. .PP The \fBbuildah build\fR command allows building images for all Linux architectures, even non-native architectures. When building images for a different architecture, the \fBRUN\fR instructions require emulation software installed on the host provided by packages like \fBqemu-user-static\fR\&. Note: it is always preferred to build images on the native architecture if possible. .PP \fBNOTE:\fP The \fB--platform\fR option may not be used in combination with the \fB--arch\fR, \fB--os\fR, or \fB--variant\fR options. .PP \fB--pull\fP .PP When the flag is enabled or set explicitly to \fBtrue\fR (with \fI--pull=true\fP), attempt to pull the latest image from the registries listed in registries.conf if a local image does not exist or the image is newer than the one in storage. Raise an error if the image is not in any listed registry and is not present locally. .PP If the flag is disabled (with \fI--pull=false\fP), do not pull the image from the registry, use only the local version. Raise an error if the image is not present locally. .PP If the pull flag is set to \fBalways\fR (with \fI--pull=always\fP), pull the image from the first registry it is found in as listed in registries.conf. Raise an error if not found in the registries, even if the image is present locally. .PP If the pull flag is set to \fBmissing\fR (with \fI--pull=missing\fP), pull the image only if it could not be found in the local containers storage. Raise an error if no image could be found and the pull fails. .PP If the pull flag is set to \fBnever\fR (with \fI--pull=never\fP), Do not pull the image from the registry, use only the local version. Raise an error if the image is not present locally. .PP Defaults to \fItrue\fP\&. .PP \fB--quiet\fP, \fB-q\fP .PP Suppress output messages which indicate which instruction is being processed, and of progress when pulling images from a registry, and when writing the output image. .PP \fB--retry\fP \fIattempts\fP .PP Number of times to retry in case of failure when performing push/pull of images to/from registry. .PP Defaults to \fB3\fR\&. .PP \fB--retry-delay\fP \fIduration\fP .PP Duration of delay between retry attempts in case of failure when performing push/pull of images to/from registry. .PP Defaults to \fB2s\fR\&. .PP \fB--rm\fP \fIbool-value\fP .PP Remove intermediate containers after a successful build (default true). .PP \fB--runtime\fP \fIpath\fP .PP The \fIpath\fP to an alternate OCI-compatible runtime, which will be used to run commands specified by the \fBRUN\fP instruction. Default is \fBrunc\fR, or \fBcrun\fR when machine is configured to use cgroups V2. .PP Note: You can also override the default runtime by setting the BUILDAH_RUNTIME environment variable. \fBexport BUILDAH_RUNTIME=/usr/bin/crun\fR .PP \fB--runtime-flag\fP \fIflag\fP .PP Adds global flags for the container rutime. To list the supported flags, please consult the manpages of the selected container runtime. .PP Note: Do not pass the leading \fB--\fR to the flag. To pass the runc flag \fB--log-format json\fR to buildah build, the option given would be \fB--runtime-flag log-format=json\fR\&. .PP \fB--secret\fP=\fBid=id,src=path\fP .PP Pass secret information to be used in the Containerfile for building images in a safe way that will not end up stored in the final image, or be seen in other stages. The secret will be mounted in the container at the default location of \fB/run/secrets/id\fR\&. .PP To later use the secret, use the --mount flag in a \fBRUN\fR instruction within a \fBContainerfile\fR: .PP \fBRUN --mount=type=secret,id=mysecret cat /run/secrets/mysecret\fR .PP Note: Changing the contents of secret files will not trigger a rebuild of layers that use said secrets. .PP \fB--security-opt\fP=[] .PP Security Options .PP "apparmor=unconfined" : Turn off apparmor confinement for the container "apparmor=your-profile" : Set the apparmor confinement profile for the container .PP "label=user:USER" : Set the label user for the container "label=role:ROLE" : Set the label role for the container "label=type:TYPE" : Set the label type for the container "label=level:LEVEL" : Set the label level for the container "label=disable" : Turn off label confinement for the container "no-new-privileges" : Disable container processes from gaining additional privileges .PP "seccomp=unconfined" : Turn off seccomp confinement for the container "seccomp=profile.json : White listed syscalls seccomp Json file to be used as a seccomp filter .PP \fB--shm-size\fP="" .PP Size of \fB/dev/shm\fR\&. The format is \fB\fR\&. \fBnumber\fR must be greater than \fB0\fR\&. Unit is optional and can be \fBb\fR (bytes), \fBk\fR (kilobytes), \fBm\fR(megabytes), or \fBg\fR (gigabytes). If you omit the unit, the system uses bytes. If you omit the size entirely, the system uses \fB64m\fR\&. .PP \fB--sign-by\fP \fIfingerprint\fP .PP Sign the built image using the GPG key that matches the specified fingerprint. .PP \fB--skip-unused-stages\fP \fIbool-value\fP .PP Skip stages in multi-stage builds which don't affect the target stage. (Default is \fBtrue\fR). .PP \fB--squash\fP .PP Squash all layers, including those from base image(s), into one single layer. (Default is false). .PP By default, Buildah preserves existing base-image layers and adds only one new layer on a build. The --layers option can be used to preserve intermediate build layers. .PP \fB--ssh\fP=\fBdefault\fP|\fIid[=socket>|[,]\fP .PP SSH agent socket or keys to expose to the build. The socket path can be left empty to use the value of \fBdefault=$SSH_AUTH_SOCK\fR .PP To later use the ssh agent, use the --mount flag in a \fBRUN\fR instruction within a \fBContainerfile\fR: .PP \fBRUN --mount=type=secret,id=id mycmd\fR .PP \fB--stdin\fP .PP Pass stdin into the RUN containers. Sometimes commands being RUN within a Containerfile want to request information from the user. For example apt asking for a confirmation for install. Use --stdin to be able to interact from the terminal during the build. .PP \fB--tag\fP, \fB-t\fP \fIimageName\fP .PP Specifies the name which will be assigned to the resulting image if the build process completes successfully. If \fIimageName\fP does not include a registry name component, the registry name \fIlocalhost\fP will be prepended to the image name. .PP \fB--target\fP \fIstageName\fP .PP Set the target build stage to build. When building a Containerfile with multiple build stages, --target can be used to specify an intermediate build stage by name as the final stage for the resulting image. Commands after the target stage will be skipped. .PP \fB--timestamp\fP \fIseconds\fP .PP Set the create timestamp to seconds since epoch to allow for deterministic builds (defaults to current time). By default, the created timestamp is changed and written into the image manifest with every commit, causing the image's sha256 hash to be different even if the sources are exactly the same otherwise. When --timestamp is set, the created timestamp is always set to the time specified and therefore not changed, allowing the image's sha256 to remain the same. All files committed to the layers of the image will be created with the timestamp. .PP \fB--tls-verify\fP \fIbool-value\fP .PP Require HTTPS and verification of certificates when talking to container registries (defaults to true). TLS verification cannot be used when talking to an insecure registry. .PP \fB--ulimit\fP \fItype\fP=\fIsoft-limit\fP[:\fIhard-limit\fP] .PP Specifies resource limits to apply to processes launched when processing \fBRUN\fR instructions. This option can be specified multiple times. Recognized resource types include: "core": maximum 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) "nofile": maximum number of open files (1048576); when run by root "nproc": maximum number of processes (ulimit -u) "nproc": maximum number of processes (1048576); when run by root "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) .PP \fB--unsetenv\fP \fIenv\fP .PP Unset environment variables from the final image. .PP \fB--unsetlabel\fP \fIlabel\fP .PP Unset the image label, causing the label not to be inherited from the base image. .PP \fB--userns\fP \fIhow\fP .PP Sets the configuration for user namespaces when handling \fBRUN\fR instructions. The configured value can be "" (the empty string) , "private" or "auto" to indicate that a new user namespace should be created, it can be "host" to indicate that the user namespace in which \fBbuildah\fR itself is being run should be reused, or it can be the path to an user namespace which is already in use by another process. .PP auto: automatically create a unique user namespace. .PP The --userns=auto flag, requires that the user name containers and a range of subordinate user ids that the build container is allowed to use be specified in the /etc/subuid and /etc/subgid files. .PP Example: \fBcontainers:2147483647:2147483648\fR\&. .PP Buildah allocates unique ranges of UIDs and GIDs from the containers subordinate user ids. The size of the ranges is based on the number of UIDs required in the image. The number of UIDs and GIDs can be overridden with the size option. .PP Valid \fBauto\fR options: .RS .IP \(bu 2 gidmapping=CONTAINER_GID:HOST_GID:SIZE: to force a GID mapping to be present in the user namespace. .IP \(bu 2 size=SIZE: to specify an explicit size for the automatic user namespace. e.g. --userns=auto:size=8192. If size is not specified, auto will estimate a size for the user namespace. .IP \(bu 2 uidmapping=CONTAINER_UID:HOST_UID:SIZE: to force a UID mapping to be present in the user namespace. .RE .PP \fB--userns-gid-map\fP \fImapping\fP .PP Directly specifies a GID mapping which should be used to set ownership, at the filesystem level, on the working container's contents. Commands run when handling \fBRUN\fR instructions will default to being run in their own user namespaces, configured using the UID and GID maps. .PP Entries in this map take the form of one or more colon-separated triples of a starting in-container GID, a corresponding starting host-level GID, and the number of consecutive IDs which the map entry represents. .PP This option overrides the \fIremap-gids\fP setting in the \fIoptions\fP section of /etc/containers/storage.conf. .PP If this option is not specified, but a global --userns-gid-map setting is supplied, settings from the global option will be used. .PP \fB--userns-gid-map-group\fP \fIgroup\fP .PP Specifies that a GID mapping which should be used to set ownership, at the filesystem level, on the working container's contents, can be found in entries in the \fB/etc/subgid\fR file which correspond to the specified group. Commands run when handling \fBRUN\fR instructions will default to being run in their own user namespaces, configured using the UID and GID maps. If --userns-uid-map-user is specified, but --userns-gid-map-group is not specified, \fBbuildah\fR will assume that the specified user name is also a suitable group name to use as the default setting for this option. .PP Users can specify the maps directly using \fB--userns-gid-map\fR described in the buildah(1) man page. .PP \fBNOTE:\fP When this option is specified by a rootless user, the specified mappings are relative to the rootless usernamespace in the container, rather than being relative to the host as it would be when run rootful. .PP \fB--userns-uid-map\fP \fImapping\fP .PP Directly specifies a UID mapping which should be used to set ownership, at the filesystem level, on the working container's contents. Commands run when handling \fBRUN\fR instructions will default to being run in their own user namespaces, configured using the UID and GID maps. .PP Entries in this map take the form of one or more colon-separated triples of a starting in-container UID, a corresponding starting host-level UID, and the number of consecutive IDs which the map entry represents. .PP This option overrides the \fIremap-uids\fP setting in the \fIoptions\fP section of /etc/containers/storage.conf. .PP If this option is not specified, but a global --userns-uid-map setting is supplied, settings from the global option will be used. .PP \fB--userns-uid-map-user\fP \fIuser\fP .PP Specifies that a UID mapping which should be used to set ownership, at the filesystem level, on the working container's contents, can be found in entries in the \fB/etc/subuid\fR file which correspond to the specified user. Commands run when handling \fBRUN\fR instructions will default to being run in their own user namespaces, configured using the UID and GID maps. If --userns-gid-map-group is specified, but --userns-uid-map-user is not specified, \fBbuildah\fR will assume that the specified group name is also a suitable user name to use as the default setting for this option. .PP \fBNOTE:\fP When this option is specified by a rootless user, the specified mappings are relative to the rootless usernamespace in the container, rather than being relative to the host as it would be when run rootful. .PP \fB--uts\fP \fIhow\fP .PP Sets the configuration for UTS namespaces when handling \fBRUN\fR instructions. The configured value can be "" (the empty string) or "container" to indicate that a new UTS namespace should be created, or it can be "host" to indicate that the UTS namespace in which \fBbuildah\fR itself is being run should be reused, or it can be the path to a UTS namespace which is already in use by another process. .PP \fB--variant\fP="" .PP Set the architecture variant of the image to be pulled. .PP \fB--volume\fP, \fB-v\fP[=\fI[HOST-DIR:CONTAINER-DIR[:OPTIONS]]\fP] .PP Mount a host directory into containers when executing \fIRUN\fP instructions during the build. The \fBOPTIONS\fR are a comma delimited list and can be: [1] \[la]#Footnote1\[ra] .RS .IP \(bu 2 [rw|ro] .IP \(bu 2 [U] .IP \(bu 2 [z|Z|O] .IP \(bu 2 [\fB[r]shared\fR|\fB[r]slave\fR|\fB[r]private\fR] .RE .PP The \fBCONTAINER-DIR\fR must be an absolute path such as \fB/src/docs\fR\&. The \fBHOST-DIR\fR must be an absolute path as well. Buildah bind-mounts the \fBHOST-DIR\fR to the path you specify. For example, if you supply \fB/foo\fR as the host path, Buildah copies the contents of \fB/foo\fR to the container filesystem on the host and bind mounts that into the container. .PP You can specify multiple \fB-v\fP options to mount one or more mounts to a container. .PP \fBWrite Protected Volume Mounts\fR .PP You can add the \fB:ro\fR or \fB:rw\fR suffix to a volume to mount it read-only or read-write mode, respectively. By default, the volumes are mounted read-write. See examples. .PP \fBChowning Volume Mounts\fR .PP By default, Buildah does not change the owner and group of source volume directories mounted into containers. If a container is created in a new user namespace, the UID and GID in the container may correspond to another UID and GID on the host. .PP The \fB:U\fR suffix tells Buildah to use the correct host UID and GID based on the UID and GID within the container, to change the owner and group of the source volume. .PP \fBLabeling Volume Mounts\fR .PP Labeling systems like SELinux require that proper labels are placed on volume content mounted into a container. Without a label, the security system might prevent the processes running inside the container from using the content. By default, Buildah does not change the labels set by the OS. .PP To change a label in the container context, you can add either of two suffixes \fB:z\fR or \fB:Z\fR to the volume mount. These suffixes tell Buildah to relabel file objects on the shared volumes. The \fBz\fR option tells Buildah that two containers share the volume content. As a result, Buildah labels the content with a shared content label. Shared volume labels allow all containers to read/write content. The \fBZ\fR option tells Buildah to label the content with a private unshared label. Only the current container can use a private volume. .PP \fBOverlay Volume Mounts\fR .PP The \fB:O\fR flag tells Buildah to mount the directory from the host as a temporary storage using the Overlay file system. The \fBRUN\fR command containers are allowed to modify contents within the mountpoint and are stored in the container storage in a separate directory. In Overlay FS terms the source directory will be the lower, and the container storage directory will be the upper. Modifications to the mount point are destroyed when the \fBRUN\fR command finishes executing, similar to a tmpfs mount point. .PP Any subsequent execution of \fBRUN\fR commands sees the original source directory content, any changes from previous RUN commands no longer exist. .PP One use case of the \fBoverlay\fR mount is sharing the package cache from the host into the container to allow speeding up builds. .PP Note: .EX - The `O` flag is not allowed to be specified with the `Z` or `z` flags. Content mounted into the container is labeled with the private label. On SELinux systems, labels in the source directory must be readable by the container label. If not, SELinux container separation must be disabled for the container to work. - Modification of the directory volume mounted into the container with an overlay mount can cause unexpected failures. It is recommended that you do not modify the directory until the container finishes running. .EE .PP By default bind mounted volumes are \fBprivate\fR\&. That means any mounts done inside container will not be visible on the host and vice versa. This behavior can be changed by specifying a volume mount propagation property. .PP When the mount propagation policy is set to \fBshared\fR, any mounts completed inside the container on that volume will be visible to both the host and container. When the mount propagation policy is set to \fBslave\fR, one way mount propagation is enabled and any mounts completed on the host for that volume will be visible only inside of the container. To control the mount propagation property of the volume use the \fB:[r]shared\fR, \fB:[r]slave\fR or \fB:[r]private\fR propagation flag. The propagation property can be specified only for bind mounted volumes and not for internal volumes or named volumes. For mount propagation to work on the source mount point (the mount point where source dir is mounted on) it has to have the right propagation properties. For shared volumes, the source mount point has to be shared. And for slave volumes, the source mount has to be either shared or slave. [1] \[la]#Footnote1\[ra] .PP Use \fBdf \fR to determine the source mount and then use \fBfindmnt -o TARGET,PROPAGATION \fR to determine propagation properties of source mount, if \fBfindmnt\fR utility is not available, the source mount point can be determined by looking at the mount entry in \fB/proc/self/mountinfo\fR\&. Look at \fBoptional fields\fR and see if any propagation properties are specified. \fBshared:X\fR means the mount is \fBshared\fR, \fBmaster:X\fR means the mount is \fBslave\fR and if nothing is there that means the mount is \fBprivate\fR\&. [1] \[la]#Footnote1\[ra] .PP To change propagation properties of a mount point use the \fBmount\fR command. For example, to bind mount the source directory \fB/foo\fR do \fBmount --bind /foo /foo\fR and \fBmount --make-private --make-shared /foo\fR\&. This will convert /foo into a \fBshared\fR mount point. The propagation properties of the source mount can be changed directly. For instance if \fB/\fR is the source mount for \fB/foo\fR, then use \fBmount --make-shared /\fR to convert \fB/\fR into a \fBshared\fR mount. .SH BUILD TIME VARIABLES .PP The ENV instruction in a Containerfile can be used to define variable values. When the image is built, the values will persist in the container image. At times it is more convenient to change the values in the Containerfile via a command-line option rather than changing the values within the Containerfile itself. .PP The following variables can be used in conjunction with the \fB--build-arg\fR option to override the corresponding values set in the Containerfile using the \fBENV\fR instruction. .RS .IP \(bu 2 HTTP_PROXY .IP \(bu 2 HTTPS_PROXY .IP \(bu 2 FTP_PROXY .IP \(bu 2 NO_PROXY .RE .PP Please refer to the Using Build Time Variables \[la]#using\-build\-time\-variables\[ra] section of the Examples. .SH EXAMPLE .SS Build an image using local Containerfiles .PP buildah build . .PP buildah build -f Containerfile . .PP cat ~/Containerfile | buildah build -f - . .PP buildah build -f Containerfile.simple -f Containerfile.notsosimple . .PP buildah build --timestamp=$(date '+%s') -t imageName . .PP buildah build -t imageName . .PP buildah build --tls-verify=true -t imageName -f Containerfile.simple . .PP buildah build --tls-verify=false -t imageName . .PP buildah build --runtime-flag log-format=json . .PP buildah build -f Containerfile --runtime-flag debug . .PP buildah build --authfile /tmp/auths/myauths.json --cert-dir ~/auth --tls-verify=true --creds=username:password -t imageName -f Containerfile.simple . .PP buildah build --memory 40m --cpu-period 10000 --cpu-quota 50000 --ulimit nofile=1024:1028 -t imageName . .PP buildah build --security-opt label=level:s0:c100,c200 --cgroup-parent /path/to/cgroup/parent -t imageName . .PP buildah build --arch=arm --variant v7 -t imageName . .PP buildah build --volume /home/test:/myvol:ro,Z -t imageName . .PP buildah build -v /home/test:/myvol:z,U -t imageName . .PP buildah build -v /var/lib/dnf:/var/lib/dnf:O -t imageName . .PP buildah build --layers -t imageName . .PP buildah build --no-cache -t imageName . .PP buildah build -f Containerfile --layers --force-rm -t imageName . .PP buildah build --no-cache --rm=false -t imageName . .PP buildah build --dns-search=example.com --dns=223.5.5.5 --dns-option=use-vc . .PP buildah build -f Containerfile.in --cpp-flag="-DDEBUG" -t imageName . .PP buildah build --network mynet . .PP buildah build --env LANG=en_US.UTF-8 -t imageName . .PP buildah build --env EDITOR -t imageName . .PP buildah build --unsetenv LANG -t imageName . .PP buildah build --os-version 10.0.19042.1645 -t imageName . .PP buildah build --os-feature win32k -t imageName . .PP buildah build --os-feature win32k- -t imageName . .SS Building an multi-architecture image using the --manifest option (requires emulation software) .PP buildah build --arch arm --manifest myimage /tmp/mysrc .PP buildah build --arch amd64 --manifest myimage /tmp/mysrc .PP buildah build --arch s390x --manifest myimage /tmp/mysrc .PP buildah bud --platform linux/s390x,linux/ppc64le,linux/amd64 --manifest myimage /tmp/mysrc .PP buildah build --platform linux/arm64 --platform linux/amd64 --manifest myimage /tmp/mysrc .PP buildah bud --all-platforms --manifest myimage /tmp/mysrc .SS Building an image using (--output) custom build output .PP buildah build -o out . .PP buildah build --output type=local,dest=out . .PP buildah build --output type=tar,dest=out.tar . .PP buildah build -o - . > out.tar .SS Building an image using a URL .PP This will clone the specified GitHub repository from the URL and use it as context. The Containerfile or Dockerfile at the root of the repository is used as the context of the build. This only works if the GitHub repository is a dedicated repository. .PP buildah build https://github.com/containers/PodmanHello.git .PP Note: Github does not support using \fBgit://\fR for performing \fBclone\fR operation due to recent changes in their security guidance (https://github.blog/2021-09-01-improving-git-protocol-security-github/). Use an \fBhttps://\fR URL if the source repository is hosted on Github. .SS Building an image using a URL to a tarball'ed context .PP Buildah will fetch the tarball archive, decompress it and use its contents as the build context. The Containerfile or Dockerfile at the root of the archive and the rest of the archive will get used as the context of the build. If you pass an -f PATH/Containerfile option as well, the system will look for that file inside the contents of the tarball. .PP buildah build -f dev/Containerfile https://10.10.10.1/buildah/context.tar.gz .PP Note: supported compression formats are 'xz', 'bzip2', 'gzip' and 'identity' (no compression). .SS Using Build Time Variables .SS Replace the value set for the HTTP_PROXY environment variable within the Containerfile. .PP buildah build --build-arg=HTTP_PROXY="http://127.0.0.1:8321" .SH ENVIRONMENT .PP \fBBUILD_REGISTRY_SOURCES\fP .PP BUILD_REGISTRY_SOURCES, if set, is treated as a JSON object which contains lists of registry names under the keys \fBinsecureRegistries\fR, \fBblockedRegistries\fR, and \fBallowedRegistries\fR\&. .PP When pulling an image from a registry, if the name of the registry matches any of the items in the \fBblockedRegistries\fR list, the image pull attempt is denied. If there are registries in the \fBallowedRegistries\fR list, and the registry's name is not in the list, the pull attempt is denied. .PP \fBTMPDIR\fP The TMPDIR environment variable allows the user to specify where temporary files are stored while pulling and pushing images. Defaults to '/var/tmp'. .SH Files .SS \fB\&.containerignore\fR/\fB\&.dockerignore\fR .PP If the .containerignore/.dockerignore file exists in the context directory, \fBbuildah build\fR reads its contents. If both exist, then .containerignore is used. Use the \fB--ignorefile\fR flag to override the ignore file path location. Buildah uses the content to exclude files and directories from the context directory, when executing COPY and ADD directives in the Containerfile/Dockerfile .PP Users can specify a series of Unix shell globals in a .containerignore/.dockerignore file to identify files/directories to exclude. .PP Buildah supports a special wildcard string \fB**\fR which matches any number of directories (including zero). For example, *\fI/\fP\&.go will exclude all files that end with .go that are found in all directories. .PP Example .containerignore file: .EX # exclude this content for image */*.c **/output* src .EE .PP \fB*/*.c\fR Excludes files and directories whose names end with .c in any top level subdirectory. For example, the source file include/rootless.c. .PP \fB**/output*\fR Excludes files and directories starting with \fBoutput\fR from any directory. .PP \fBsrc\fR Excludes files named src and the directory src as well as any content in it. .PP Lines starting with ! (exclamation mark) can be used to make exceptions to exclusions. The following is an example .containerignore/.dockerignore file that uses this mechanism: .EX *.doc !Help.doc .EE .PP Exclude all doc files except Help.doc from the image. .PP This functionality is compatible with the handling of .containerignore files described here: .PP https://github.com/containers/buildah/blob/main/docs/containerignore.5.md .PP \fBregistries.conf\fP (\fB/etc/containers/registries.conf\fR) .PP registries.conf is the configuration file which specifies which container registries should be consulted when completing image names which do not include a registry or domain portion. .PP \fBpolicy.json\fP (\fB/etc/containers/policy.json\fR) .PP Signature policy file. This defines the trust policy for container images. Controls which container registries can be used for image, and whether or not the tool should trust the images. .SH SEE ALSO .PP buildah(1), cpp(1), buildah-login(1), docker-login(1), namespaces(7), pid_namespaces(7), containers-policy.json(5), containers-registries.conf(5), user_namespaces(7), crun(1), runc(8), containers.conf(5), oci-hooks(5) .SH FOOTNOTES .PP 1: The Buildah project is committed to inclusivity, a core value of open source. The \fBmaster\fR and \fBslave\fR mount propagation terminology used here is problematic and divisive, and should be changed. However, these terms are currently used within the Linux kernel and must be used as-is at this time. When the kernel maintainers rectify this usage, Buildah will follow suit immediately.