1buildah-add(1) General Commands Manual buildah-add(1)
2
3
4
6 buildah-add - Add the contents of a file, URL, or a directory to a con‐
7 tainer.
8
9
11 buildah add [options] container src [[src ...] dest]
12
13
15 Adds the contents of a file, URL, or a directory to a container's work‐
16 ing directory or a specified location in the container. If a local
17 source file appears to be an archive, its contents are extracted and
18 added instead of the archive file itself. If a local directory is
19 specified as a source, its contents are copied to the destination.
20
21
23 --add-history
24
25
26 Add an entry to the history which will note the digest of the added
27 content. Defaults to false.
28
29
30 Note: You can also override the default value of --add-history by set‐
31 ting the BUILDAH_HISTORY environment variable. export BUILDAH_HIS‐
32 TORY=true
33
34
35 --chown owner:group
36
37
38 Sets the user and group ownership of the destination content.
39
40
41 --contextdir
42
43
44 Build context directory. Specifying a context directory causes Buildah
45 to chroot into that context directory. This means copying files pointed
46 at by symbolic links outside of the chroot will fail.
47
48
49 --ignorefile
50
51
52 Path to an alternative .dockerignore file. Requires --contextdir be
53 specified.
54
55
56 --quiet, -q
57
58
59 Refrain from printing a digest of the added content.
60
61
63 buildah add containerID '/myapp/app.conf' '/myapp/app.conf'
64
65
66 buildah add --chown myuser:mygroup containerID '/myapp/app.conf'
67 '/myapp/app.conf'
68
69
70 buildah add containerID '/home/myuser/myproject.go'
71
72
73 buildah add containerID '/home/myuser/myfiles.tar' '/tmp'
74
75
76 buildah add containerID '/tmp/workingdir' '/tmp/workingdir'
77
78
79 buildah add containerID 'https://github.com/containers/buil‐
80 dah/blob/master/README.md' '/tmp'
81
82
83 buildah add containerID 'passwd' 'certs.d' /etc
84
85
87 .dockerignore
88 When the \fB\fC--ignorefile\fR option is specified Buildah reads the
89 content to exclude files and directories from the source directory,
90 when copying content into the image.
91
92
93 Users can specify a series of Unix shell globals in a ignore file to
94 identify files/directories to exclude.
95
96
97 Buildah supports a special wildcard string ** which matches any number
98 of directories (including zero). For example, */.go will exclude all
99 files that end with .go that are found in all directories.
100
101
102 Example .dockerignore file:
103
104
105 # here are files we want to exclude
106 */*.c
107 **/output*
108 src
109
110
111
112 */*.c Excludes files and directories whose names ends with .c in any
113 top level subdirectory. For example, the source file include/root‐
114 less.c.
115
116
117 **/output* Excludes files and directories starting with output from any
118 directory.
119
120
121 src Excludes files named src and the directory src as well as any con‐
122 tent in it.
123
124
125 Lines starting with ! (exclamation mark) can be used to make exceptions
126 to exclusions. The following is an example .dockerignore file that uses
127 this mechanism:
128
129
130 *.doc
131 !Help.doc
132
133
134
135 Exclude all doc files except Help.doc from the image.
136
137
138 This functionality is compatible with the handling of .dockerignore
139 files described here:
140
141
142 https://docs.docker.com/engine/reference/builder/#dockerignore-file
143
144
146 buildah(1)
147
148
149
150buildah March 2017 buildah-add(1)