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

NAME

6       buildah-copy  - Copies the contents of a file, URL, or directory into a
7       container's working directory.
8
9

SYNOPSIS

11       buildah copy container src [[src ...] dest]
12
13

DESCRIPTION

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

OPTIONS

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

EXAMPLE

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

FILES

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

SEE ALSO

197       buildah(1), containerignore(5)
198
199
200
201buildah                           April 2021                   buildah-copy(1)
Impressum