1buildah-copy(1) General Commands Manual buildah-copy(1)
2
3
4
6 buildah-copy - Copies the contents of a file, URL, or directory into a
7 container's working directory.
8
9
11 buildah copy container src [[src ...] dest]
12
13
15 Copies the contents of a file, URL, or a directory to a container's
16 working directory or a specified location in the container. If a local
17 directory is specified as a source, its contents are copied to the des‐
18 tination.
19
20
22 --add-history
23
24
25 Add an entry to the history which will note the digest of the added
26 content. Defaults to false.
27
28
29 Note: You can also override the default value of --add-history by set‐
30 ting the BUILDAH_HISTORY environment variable. export BUILDAH_HIS‐
31 TORY=true
32
33
34 --chmod permissions
35
36
37 Sets the access permissions of the destination content. Accepts the nu‐
38 merical format.
39
40
41 --chown owner:group
42
43
44 Sets the user and group ownership of the destination content.
45
46
47 --contextdir directory
48
49
50 Build context directory. Specifying a context directory causes Buildah
51 to chroot into the context directory. This means copying files pointed
52 at by symbolic links outside of the chroot will fail.
53
54
55 --from containerOrImage
56
57
58 Use the root directory of the specified working container or image as
59 the root directory when resolving absolute source paths and the path of
60 the context directory. If an image needs to be pulled, options recog‐
61 nized by buildah pull can be used.
62
63
64 --ignorefile file
65
66
67 Path to an alternative .containerignore (.dockerignore) file. Requires
68 --contextdir be specified.
69
70
71 --quiet, -q
72
73
74 Refrain from printing a digest of the copied content.
75
76
78 buildah copy containerID '/myapp/app.conf' '/myapp/app.conf'
79
80
81 buildah copy --chown myuser:mygroup containerID '/myapp/app.conf'
82 '/myapp/app.conf'
83
84
85 buildah copy --chmod 660 containerID '/myapp/app.conf'
86 '/myapp/app.conf'
87
88
89 buildah copy containerID '/home/myuser/myproject.go'
90
91
92 buildah copy containerID '/home/myuser/myfiles.tar' '/tmp'
93
94
95 buildah copy containerID '/tmp/workingdir' '/tmp/workingdir'
96
97
98 buildah copy containerID 'https://github.com/containers/buildah' '/tmp'
99
100
101 buildah copy containerID 'passwd' 'certs.d' /etc
102
103
105 .containerignore/.dockerignore
106 If the .containerignore/.dockerignore file exists in the context direc‐
107 tory, buildah copy reads its contents. If both exist, then .container‐
108 ignore is used.
109
110
111 When the \fB\fC--ignorefile\fR option is specified Buildah reads it and
112 uses it to decide which content to exclude when copying content into
113 the working container.
114
115
116 Users can specify a series of Unix shell glob patterns in an ignore
117 file to identify files/directories to exclude.
118
119
120 Buildah supports a special wildcard string ** which matches any number
121 of directories (including zero). For example, */.go will exclude all
122 files that end with .go that are found in all directories.
123
124
125 Example .containerignore/.dockerignore file:
126
127
128 # here are files we want to exclude
129 */*.c
130 **/output*
131 src
132
133
134
135 */*.c Excludes files and directories whose names end with .c in any top
136 level subdirectory. For example, the source file include/rootless.c.
137
138
139 **/output* Excludes files and directories starting with output from any
140 directory.
141
142
143 src Excludes files named src and the directory src as well as any con‐
144 tent in it.
145
146
147 Lines starting with ! (exclamation mark) can be used to make exceptions
148 to exclusions. The following is an example .containerignore/.dockerig‐
149 nore file that uses this mechanism:
150
151
152 *.doc
153 !Help.doc
154
155
156
157 Exclude all doc files except Help.doc when copying content into the
158 container.
159
160
161 This functionality is compatible with the handling of .containerignore
162 files described here:
163
164
165 https://github.com/containers/buildah/blob/main/docs/containerig‐
166 nore.5.md
167
168
170 buildah(1), containerignore(5)
171
172
173
174buildah April 2021 buildah-copy(1)