1buildah-commit(1) General Commands Manual buildah-commit(1)
2
3
4
6 buildah-commit - Create an image from a working container.
7
8
10 buildah commit [options] container [image]
11
12
14 Writes a new image using the specified container's read-write layer and
15 if it is based on an image, the layers of that image. If image does
16 not begin with a registry name component, localhost will be added to
17 the name. If image is not provided, the image will have no name. When
18 an image has no name, the buildah images command will display <none> in
19 the REPOSITORY and TAG columns.
20
21
23 The image ID of the image that was created. On error, 1 is returned
24 and errno is returned.
25
26
28 --authfile path
29
30
31 Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/contain‐
32 ers/auth.json, which is set using buildah login. If the authorization
33 state is not found there, $HOME/.docker/config.json is checked, which
34 is set using docker login.
35
36
37 --cert-dir path
38
39
40 Use certificates at path (*.crt, *.cert, *.key) to connect to the reg‐
41 istry. The default certificates directory is /etc/containers/certs.d.
42
43
44 --creds creds
45
46
47 The [username[:password]] to use to authenticate with the registry if
48 required. If one or both values are not supplied, a command line
49 prompt will appear and the value can be entered. The password is
50 entered without echo.
51
52
53 --disable-compression, -D
54
55
56 Don't compress filesystem layers when building the image unless it is
57 required by the location where the image is being written. This is the
58 default setting, because image layers are compressed automatically when
59 they are pushed to registries, and images being written to local stor‐
60 age would only need to be decompressed again to be stored. Compression
61 can be forced in all cases by specifying --disable-compression=false.
62
63
64 --encryption-key key
65
66
67 The [protocol:keyfile] specifies the encryption protocol, which can be
68 JWE (RFC7516), PGP (RFC4880), and PKCS7 (RFC2315) and the key material
69 required for image encryption. For instance, jwe:/path/to/key.pem or
70 pgp:admin@example.com or pkcs7:/path/to/x509-file.
71
72
73 --encrypt-layer layer(s)
74
75
76 Layer(s) to encrypt: 0-indexed layer indices with support for negative
77 indexing (e.g. 0 is the first layer, -1 is the last layer). If not
78 defined, will encrypt all layers if encryption-key flag is specified.
79
80
81 --format, -f [oci | docker]
82
83
84 Control the format for the image manifest and configuration data. Rec‐
85 ognized formats include oci (OCI image-spec v1.0, the default) and
86 docker (version 2, using schema format 2 for the manifest).
87
88
89 Note: You can also override the default format by setting the BUIL‐
90 DAH_FORMAT environment variable. export BUILDAH\_FORMAT=docker
91
92
93 --iidfile ImageIDfile
94
95
96 Write the image ID to the file.
97
98
99 --manifest "manifest"
100
101
102 Name of the manifest list to which the image will be added. Creates the
103 manifest list if it does not exist. This option is useful for building
104 multi architecture images.
105
106
107 --quiet, -q
108
109
110 When writing the output image, suppress progress output.
111
112
113 --rm Remove the working container and its contents after creating the
114 image. Default leaves the container and its content in place.
115
116
117 --sign-by fingerprint
118
119
120 Sign the new image using the GPG key that matches the specified finger‐
121 print.
122
123
124 --squash
125
126
127 Squash all of the new image's layers (including those inherited from a
128 base image) into a single new layer.
129
130
131 --timestamp seconds
132
133
134 Set the create timestamp to seconds since epoch to allow for determin‐
135 istic builds (defaults to current time). By default, the created time‐
136 stamp is changed and written into the image manifest with every commit,
137 causing the image's sha256 hash to be different even if the sources are
138 exactly the same otherwise. When --timestamp is set, the created time‐
139 stamp is always set to the time specified and therefore not changed,
140 allowing the image's sha256 to remain the same. All files committed to
141 the layers of the image will be created with the timestamp.
142
143
144 --tls-verify bool-value
145
146
147 Require HTTPS and verification of certificates when talking to con‐
148 tainer registries (defaults to true). TLS verification cannot be used
149 when talking to an insecure registry.
150
151
153 This example saves an image based on the container.
154 buildah commit containerID newImageName
155
156
157 This example saves an image named newImageName based on the container.
158 buildah commit --rm containerID newImageName
159
160
161 This example saves an image with no name, removes the working con‐
162 tainer, and creates a new container using the image's ID.
163 buildah from $(buildah commit --rm containerID)
164
165
166 This example saves an image based on the container disabling compres‐
167 sion.
168 buildah commit --disable-compression containerID
169
170
171 This example saves an image named newImageName based on the container
172 disabling compression.
173 buildah commit --disable-compression containerID newImageName
174
175
176 This example commits the container to the image on the local registry
177 while turning off tls verification.
178 buildah commit --tls-verify=false containerID docker://local‐
179 host:5000/imageId
180
181
182 This example commits the container to the image on the local registry
183 using credentials and certificates for authentication.
184 buildah commit --cert-dir ~/auth --tls-verify=true --creds=user‐
185 name:password containerID docker://localhost:5000/imageId
186
187
188 This example commits the container to the image on the local registry
189 using credentials from the /tmp/auths/myauths.json file and certifi‐
190 cates for authentication.
191 buildah commit --authfile /tmp/auths/myauths.json --cert-dir ~/auth
192 --tls-verify=true --creds=username:password containerID docker://local‐
193 host:5000/imageName
194
195
196 This example saves an image based on the container, but stores dates
197 based on epoch time. buildah commit --timestamp=0 containerID newIma‐
198 geName
199
200
201 Building an multi-architecture image using a --manifest option (Requires
202 emulation software)
203 #!/bin/sh
204 build() {
205 ctr=$(./bin/buildah from --arch $1 ubi8)
206 ./bin/buildah run $ctr dnf install -y iputils
207 ./bin/buildah commit --manifest ubi8ping $ctr
208 }
209 build arm
210 build amd64
211 build s390x
212
213
214
216 BUILD_REGISTRY_SOURCES
217
218
219 BUILD_REGISTRY_SOURCES, if set, is treated as a JSON object which con‐
220 tains lists of registry names under the keys insecureRegistries,
221 blockedRegistries, and allowedRegistries.
222
223
224 When committing an image, if the image is to be given a name, the por‐
225 tion of the name that corresponds to a registry is compared to the
226 items in the blockedRegistries list, and if it matches any of them, the
227 commit attempt is denied. If there are registries in the allowedReg‐
228 istries list, and the portion of the name that corresponds to the reg‐
229 istry is not in the list, the commit attempt is denied.
230
231
232 TMPDIR The TMPDIR environment variable allows the user to specify where
233 temporary files are stored while pulling and pushing images. Defaults
234 to '/var/tmp'.
235
236
238 registries.conf (/etc/containers/registries.conf)
239
240
241 registries.conf is the configuration file which specifies which con‐
242 tainer registries should be consulted when completing image names which
243 do not include a registry or domain portion.
244
245
246 policy.json (/etc/containers/policy.json)
247
248
249 Signature policy file. This defines the trust policy for container
250 images. Controls which container registries can be used for image, and
251 whether or not the tool should trust the images.
252
253
255 buildah(1), buildah-images(1), containers-policy.json(5), contain‐
256 ers-registries.conf(5)
257
258
259
260buildah March 2017 buildah-commit(1)