.nh .TH buildah\-add "1" "March 2017" "buildah" .SH NAME .PP buildah\-add \- Add the contents of a file, URL, or a directory to a container. .SH SYNOPSIS .PP \fBbuildah add\fP [\fIoptions\fP] \fIcontainer\fP \fIsrc\fP [[\fIsrc\fP ...] \fIdest\fP] .SH DESCRIPTION .PP Adds 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 source file appears to be an archive, its contents are extracted and added instead of the archive file itself. 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. \fB\fCexport BUILDAH\_HISTORY=true\fR .PP \fB\-\-chown\fP \fIowner\fP:\fIgroup\fP .PP Sets the user and group ownership of the destination content. .PP \fB\-\-contextdir\fP .PP Build context directory. Specifying a context directory causes Buildah to chroot into that context directory. This means copying files pointed at by symbolic links outside of the chroot will fail. .PP \fB\-\-ignorefile\fP .PP Path to an alternative .dockerignore file. Requires \-\-contextdir be specified. .PP \fB\-\-quiet\fP, \fB\-q\fP .PP Refrain from printing a digest of the added content. .SH EXAMPLE .PP buildah add containerID '/myapp/app.conf' '/myapp/app.conf' .PP buildah add \-\-chown myuser:mygroup containerID '/myapp/app.conf' '/myapp/app.conf' .PP buildah add containerID '/home/myuser/myproject.go' .PP buildah add containerID '/home/myuser/myfiles.tar' '/tmp' .PP buildah add containerID '/tmp/workingdir' '/tmp/workingdir' .PP buildah add containerID 'https://github.com/containers/buildah/blob/master/README.md' '/tmp' .PP buildah add containerID 'passwd' 'certs.d' /etc .SH FILES .SS \&.dockerignore .PP When the \\fB\\fC\-\-ignorefile\\fR option is specified Buildah reads the content to exclude files and directories from the source directory, when copying content into the image. .PP Users can specify a series of Unix shell globals in a ignore file to identify files/directories to exclude. .PP Buildah supports a special wildcard string \fB\fC**\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 .dockerignore file: .PP .RS .nf # here are files we want to exclude */*.c **/output* src .fi .RE .PP \fB\fC*/*.c\fR Excludes files and directories whose names ends with .c in any top level subdirectory. For example, the source file include/rootless.c. .PP \fB\fC**/output*\fR Excludes files and directories starting with \fB\fCoutput\fR from any directory. .PP \fB\fCsrc\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 .dockerignore file that uses this mechanism: .PP .RS .nf *.doc !Help.doc .fi .RE .PP Exclude all doc files except Help.doc from the image. .PP This functionality is compatible with the handling of .dockerignore files described here: .PP https://docs.docker.com/engine/reference/builder/#dockerignore\-file .SH SEE ALSO .PP buildah(1)