.nh .TH buildah-copy "1" "April 2021" "buildah" .SH NAME .PP buildah-copy - Copies the contents of a file, URL, or directory into a container's working directory. .SH SYNOPSIS .PP \fBbuildah copy\fP \fIcontainer\fP \fIsrc\fP [[\fIsrc\fP ...] \fIdest\fP] .SH DESCRIPTION .PP Copies the contents of a file, URL, or a directory to a container's working directory or a specified location in the container. If a local directory is specified as a source, its \fIcontents\fP are copied to the destination. .SH OPTIONS .PP \fB--add-history\fP .PP Add an entry to the history which will note the digest of the added content. Defaults to false. .PP Note: You can also override the default value of --add-history by setting the BUILDAH_HISTORY environment variable. \fBexport BUILDAH_HISTORY=true\fR .PP \fB--chmod\fP \fIpermissions\fP .PP Sets the access permissions of the destination content. Accepts the numerical format. .PP \fB--chown\fP \fIowner\fP:\fIgroup\fP .PP Sets the user and group ownership of the destination content. .PP \fB--contextdir\fP \fIdirectory\fP .PP Build context directory. Specifying a context directory causes Buildah to chroot into the context directory. This means copying files pointed at by symbolic links outside of the chroot will fail. .PP \fB--from\fP \fIcontainerOrImage\fP .PP Use the root directory of the specified working container or image as the root directory when resolving absolute source paths and the path of the context directory. If an image needs to be pulled, options recognized by \fBbuildah pull\fR can be used. .PP \fB--ignorefile\fP \fIfile\fP .PP Path to an alternative .containerignore (.dockerignore) file. Requires --contextdir be specified. .PP \fB--quiet\fP, \fB-q\fP .PP Refrain from printing a digest of the copied content. .PP \fB--retry\fP \fIattempts\fP .PP Number of times to retry in case of failure when performing pull of images 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 pull of images from registry. .PP Defaults to \fB2s\fR\&. .SH EXAMPLE .PP buildah copy containerID '/myapp/app.conf' '/myapp/app.conf' .PP buildah copy --chown myuser:mygroup containerID '/myapp/app.conf' '/myapp/app.conf' .PP buildah copy --chmod 660 containerID '/myapp/app.conf' '/myapp/app.conf' .PP buildah copy containerID '/home/myuser/myproject.go' .PP buildah copy containerID '/home/myuser/myfiles.tar' '/tmp' .PP buildah copy containerID '/tmp/workingdir' '/tmp/workingdir' .PP buildah copy containerID 'https://github.com/containers/buildah' '/tmp' .PP buildah copy containerID 'passwd' 'certs.d' /etc .SH FILES .SS \&.containerignore/.dockerignore .PP If the .containerignore/.dockerignore file exists in the context directory, \fBbuildah copy\fR reads its contents. If both exist, then .containerignore is used. .PP When the \fB--ignorefile\fR option is specified Buildah reads it and uses it to decide which content to exclude when copying content into the working container. .PP Users can specify a series of Unix shell glob patterns in an ignore 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/.dockerignore file: .EX # here are files we want to exclude */*.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 when copying content into the container. .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 .SH SEE ALSO .PP buildah(1), containerignore(5)