1buildah-add(1)              General Commands Manual             buildah-add(1)
2
3
4

NAME

6       buildah-add - Add the contents of a file, URL, or a directory to a con‐
7       tainer.
8
9

SYNOPSIS

11       buildah add [options] container src [[src ...] dest]
12
13

DESCRIPTION

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

OPTIONS

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       --checksum checksum
36
37
38       Checksum  the  source content. The value of checksum must be a standard
39       container digest string. Only supported for HTTP sources.
40
41
42       --chmod permissions
43
44
45       Sets the access permissions of the destination content. Accepts the nu‐
46       merical format.
47
48
49       --chown owner:group
50
51
52       Sets the user and group ownership of the destination content.
53
54
55       --contextdir directory
56
57
58       Build  context directory. Specifying a context directory causes Buildah
59       to chroot into that context directory. This means copying files pointed
60       at by symbolic links outside of the chroot will fail.
61
62
63       --from containerOrImage
64
65
66       Use  the  root directory of the specified working container or image as
67       the root directory when resolving absolute source paths and the path of
68       the  context directory.  If an image needs to be pulled, options recog‐
69       nized by buildah pull can be used.
70
71
72       --ignorefile file
73
74
75       Path to an alternative .containerignore (.dockerignore) file.  Requires
76       --contextdir be specified.
77
78
79       --quiet, -q
80
81
82       Refrain from printing a digest of the added content.
83
84
85       --retry attempts
86
87
88       Number of times to retry in case of failure when performing pull of im‐
89       ages from registry.
90
91
92       Defaults to 3.
93
94
95       --retry-delay duration
96
97
98       Duration of delay between retry attempts in case of failure  when  per‐
99       forming pull of images from registry.
100
101
102       Defaults to 2s.
103
104

EXAMPLE

106       buildah add containerID '/myapp/app.conf' '/myapp/app.conf'
107
108
109       buildah   add   --chown  myuser:mygroup  containerID  '/myapp/app.conf'
110       '/myapp/app.conf'
111
112
113       buildah add --chmod 660 containerID '/myapp/app.conf' '/myapp/app.conf'
114
115
116       buildah add containerID '/home/myuser/myproject.go'
117
118
119       buildah add containerID '/home/myuser/myfiles.tar' '/tmp'
120
121
122       buildah add containerID '/tmp/workingdir' '/tmp/workingdir'
123
124
125       buildah    add     containerID     'https://github.com/containers/buil
126       dah/blob/main/README.md' '/tmp'
127
128
129       buildah add containerID 'passwd' 'certs.d' /etc
130
131

FILES

133   .containerignore
134       If  a  .containerignore or .dockerignore file exists in the context di‐
135       rectory, buildah add reads its contents.  If  both  exist,  then  .con‐
136       tainerignore is used.
137
138
139       When  the --ignorefile option is specified Buildah reads it and uses it
140       to decide which content to exclude when copying content into the  work‐
141       ing container.
142
143
144       Users  can  specify  a  series of Unix shell glob patterns in an ignore
145       file to identify files/directories to exclude.
146
147
148       Buildah supports a special wildcard string ** which matches any  number
149       of  directories  (including  zero). For example, */.go will exclude all
150       files that end with .go that are found in all directories.
151
152
153       Example .containerignore/.dockerignore file:
154
155
156              # here are files we want to exclude
157              */*.c
158              **/output*
159              src
160
161
162
163       */*.c Excludes files and directories whose names end with .c in any top
164       level subdirectory. For example, the source file include/rootless.c.
165
166
167       **/output* Excludes files and directories starting with output from any
168       directory.
169
170
171       src Excludes files named src and the directory src as well as any  con‐
172       tent in it.
173
174
175       Lines starting with ! (exclamation mark) can be used to make exceptions
176       to exclusions. The following is an example .containerignore  file  that
177       uses this mechanism:
178
179
180              *.doc
181              !Help.doc
182
183
184
185       Exclude  all  doc  files  except Help.doc when copying content into the
186       container.
187
188
189       This functionality is compatible with the handling of  .containerignore
190       files described here:
191
192
193       https://github.com/containers/buildah/blob/main/docs/containerig
194       nore.5.md
195
196

SEE ALSO

198       buildah(1), containerignore(5)
199
200
201
202buildah                           April 2021                    buildah-add(1)
Impressum