pulumi-docker 4.6.0b1__py3-none-any.whl → 4.6.0b3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pulumi-docker might be problematic. Click here for more details.

@@ -17,23 +17,33 @@ __all__ = ['ImageArgs', 'Image']
17
17
  @pulumi.input_type
18
18
  class ImageArgs:
19
19
  def __init__(__self__, *,
20
+ add_hosts: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
20
21
  build_args: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
21
22
  build_on_preview: Optional[pulumi.Input[bool]] = None,
22
23
  builder: Optional[pulumi.Input['BuilderConfigArgs']] = None,
23
- cache_from: Optional[pulumi.Input[Sequence[pulumi.Input['CacheFromEntryArgs']]]] = None,
24
- cache_to: Optional[pulumi.Input[Sequence[pulumi.Input['CacheToEntryArgs']]]] = None,
24
+ cache_from: Optional[pulumi.Input[Sequence[pulumi.Input['CacheFromArgs']]]] = None,
25
+ cache_to: Optional[pulumi.Input[Sequence[pulumi.Input['CacheToArgs']]]] = None,
25
26
  context: Optional[pulumi.Input['BuildContextArgs']] = None,
26
27
  dockerfile: Optional[pulumi.Input['DockerfileArgs']] = None,
27
- exports: Optional[pulumi.Input[Sequence[pulumi.Input['ExportEntryArgs']]]] = None,
28
+ exec_: Optional[pulumi.Input[bool]] = None,
29
+ exports: Optional[pulumi.Input[Sequence[pulumi.Input['ExportArgs']]]] = None,
28
30
  labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
31
+ load: Optional[pulumi.Input[bool]] = None,
32
+ network: Optional[pulumi.Input['NetworkMode']] = None,
33
+ no_cache: Optional[pulumi.Input[bool]] = None,
29
34
  platforms: Optional[pulumi.Input[Sequence[pulumi.Input['Platform']]]] = None,
30
35
  pull: Optional[pulumi.Input[bool]] = None,
36
+ push: Optional[pulumi.Input[bool]] = None,
31
37
  registries: Optional[pulumi.Input[Sequence[pulumi.Input['RegistryAuthArgs']]]] = None,
32
38
  secrets: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
39
+ ssh: Optional[pulumi.Input[Sequence[pulumi.Input['SSHArgs']]]] = None,
33
40
  tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
34
- targets: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None):
41
+ target: Optional[pulumi.Input[str]] = None):
35
42
  """
36
43
  The set of arguments for constructing a Image resource.
44
+ :param pulumi.Input[Sequence[pulumi.Input[str]]] add_hosts: Custom `host:ip` mappings to use during the build.
45
+
46
+ Equivalent to Docker's `--add-host` flag.
37
47
  :param pulumi.Input[Mapping[str, pulumi.Input[str]]] build_args: `ARG` names and values to set during the build.
38
48
 
39
49
  These variables are accessed like environment variables inside `RUN`
@@ -41,22 +51,98 @@ class ImageArgs:
41
51
 
42
52
  Build arguments are persisted in the image, so you should use `secrets`
43
53
  if these arguments are sensitive.
44
- :param pulumi.Input[bool] build_on_preview: When `true`, attempt to build the image during previews. The image will
45
- not be pushed to registries, however caches will still populated.
54
+
55
+ Equivalent to Docker's `--build-arg` flag.
56
+ :param pulumi.Input[bool] build_on_preview: By default, preview behavior depends on the execution environment. If
57
+ Pulumi detects the operation is running on a CI system (GitHub Actions,
58
+ Travis CI, Azure Pipelines, etc.) then it will build images during
59
+ previews as a safeguard. Otherwise, if not running on CI, previews will
60
+ not build images.
61
+
62
+ Setting this to `false` forces previews to never perform builds, and
63
+ setting it to `true` will always build the image during previews.
64
+
65
+ Images built during previews are never exported to registries, however
66
+ cache manifests are still exported.
67
+
68
+ On-disk Dockerfiles are always validated for syntactic correctness
69
+ regardless of this setting.
46
70
  :param pulumi.Input['BuilderConfigArgs'] builder: Builder configuration.
47
- :param pulumi.Input[Sequence[pulumi.Input['CacheFromEntryArgs']]] cache_from: External cache configuration.
48
- :param pulumi.Input[Sequence[pulumi.Input['CacheToEntryArgs']]] cache_to: Cache export configuration.
71
+ :param pulumi.Input[Sequence[pulumi.Input['CacheFromArgs']]] cache_from: Cache export configuration.
72
+
73
+ Equivalent to Docker's `--cache-from` flag.
74
+ :param pulumi.Input[Sequence[pulumi.Input['CacheToArgs']]] cache_to: Cache import configuration.
75
+
76
+ Equivalent to Docker's `--cache-to` flag.
49
77
  :param pulumi.Input['BuildContextArgs'] context: Build context settings.
78
+
79
+ Equivalent to Docker's `PATH | URL | -` positional argument.
50
80
  :param pulumi.Input['DockerfileArgs'] dockerfile: Dockerfile settings.
51
- :param pulumi.Input[Sequence[pulumi.Input['ExportEntryArgs']]] exports: Controls where images are persisted after building.
81
+
82
+ Equivalent to Docker's `--file` flag.
83
+ :param pulumi.Input[bool] exec_: Use `exec` mode to build this image.
84
+
85
+ By default the provider embeds a v25 Docker client with v0.12 buildx
86
+ support. This helps ensure consistent behavior across environments and
87
+ is compatible with alternative build backends (e.g. `buildkitd`), but
88
+ it may not be desirable if you require a specific version of buildx.
89
+ For example you may want to run a custom `docker-buildx` binary with
90
+ support for [Docker Build
91
+ Cloud](https://docs.docker.com/build/cloud/setup/) (DBC).
92
+
93
+ When this is set to `true` the provider will instead execute the
94
+ `docker-buildx` binary directly to perform its operations. The user is
95
+ responsible for ensuring this binary exists, with correct permissions
96
+ and pre-configured builders, at a path Docker expects (e.g.
97
+ `~/.docker/cli-plugins`).
98
+
99
+ Debugging `exec` mode may be more difficult as Pulumi will not be able
100
+ to surface fine-grained errors and warnings. Additionally credentials
101
+ are temporarily written to disk in order to provide them to the
102
+ `docker-buildx` binary.
103
+ :param pulumi.Input[Sequence[pulumi.Input['ExportArgs']]] exports: Controls where images are persisted after building.
52
104
 
53
105
  Images are only stored in the local cache unless `exports` are
54
106
  explicitly configured.
107
+
108
+ Exporting to multiple destinations requires a daemon running BuildKit
109
+ 0.13 or later.
110
+
111
+ Equivalent to Docker's `--output` flag.
55
112
  :param pulumi.Input[Mapping[str, pulumi.Input[str]]] labels: Attach arbitrary key/value metadata to the image.
56
- :param pulumi.Input[Sequence[pulumi.Input['Platform']]] platforms: Set target platform(s) for the build. Defaults to the host's platform
113
+
114
+ Equivalent to Docker's `--label` flag.
115
+ :param pulumi.Input[bool] load: When `true` the build will automatically include a `docker` export.
116
+
117
+ Defaults to `false`.
118
+
119
+ Equivalent to Docker's `--load` flag.
120
+ :param pulumi.Input['NetworkMode'] network: Set the network mode for `RUN` instructions. Defaults to `default`.
121
+
122
+ For custom networks, configure your builder with `--driver-opt network=...`.
123
+
124
+ Equivalent to Docker's `--network` flag.
125
+ :param pulumi.Input[bool] no_cache: Do not import cache manifests when building the image.
126
+
127
+ Equivalent to Docker's `--no-cache` flag.
128
+ :param pulumi.Input[Sequence[pulumi.Input['Platform']]] platforms: Set target platform(s) for the build. Defaults to the host's platform.
129
+
130
+ Equivalent to Docker's `--platform` flag.
57
131
  :param pulumi.Input[bool] pull: Always pull referenced images.
132
+
133
+ Equivalent to Docker's `--pull` flag.
134
+ :param pulumi.Input[bool] push: When `true` the build will automatically include a `registry` export.
135
+
136
+ Defaults to `false`.
137
+
138
+ Equivalent to Docker's `--push` flag.
58
139
  :param pulumi.Input[Sequence[pulumi.Input['RegistryAuthArgs']]] registries: Registry credentials. Required if reading or exporting to private
59
140
  repositories.
141
+
142
+ Credentials are kept in-memory and do not pollute pre-existing
143
+ credentials on the host.
144
+
145
+ Similar to `docker login`.
60
146
  :param pulumi.Input[Mapping[str, pulumi.Input[str]]] secrets: A mapping of secret names to their corresponding values.
61
147
 
62
148
  Unlike the Docker CLI, these can be passed by value and do not need to
@@ -64,14 +150,25 @@ class ImageArgs:
64
150
 
65
151
  Build arguments and environment variables are persistent in the final
66
152
  image, so you should use this for sensitive values.
153
+
154
+ Similar to Docker's `--secret` flag.
155
+ :param pulumi.Input[Sequence[pulumi.Input['SSHArgs']]] ssh: SSH agent socket or keys to expose to the build.
156
+
157
+ Equivalent to Docker's `--ssh` flag.
67
158
  :param pulumi.Input[Sequence[pulumi.Input[str]]] tags: Name and optionally a tag (format: `name:tag`).
68
159
 
69
160
  If exporting to a registry, the name should include the fully qualified
70
161
  registry address (e.g. `docker.io/pulumi/pulumi:latest`).
71
- :param pulumi.Input[Sequence[pulumi.Input[str]]] targets: Set the target build stage(s) to build.
162
+
163
+ Equivalent to Docker's `--tag` flag.
164
+ :param pulumi.Input[str] target: Set the target build stage(s) to build.
72
165
 
73
166
  If not specified all targets will be built by default.
167
+
168
+ Equivalent to Docker's `--target` flag.
74
169
  """
170
+ if add_hosts is not None:
171
+ pulumi.set(__self__, "add_hosts", add_hosts)
75
172
  if build_args is not None:
76
173
  pulumi.set(__self__, "build_args", build_args)
77
174
  if build_on_preview is not None:
@@ -86,22 +183,50 @@ class ImageArgs:
86
183
  pulumi.set(__self__, "context", context)
87
184
  if dockerfile is not None:
88
185
  pulumi.set(__self__, "dockerfile", dockerfile)
186
+ if exec_ is not None:
187
+ pulumi.set(__self__, "exec_", exec_)
89
188
  if exports is not None:
90
189
  pulumi.set(__self__, "exports", exports)
91
190
  if labels is not None:
92
191
  pulumi.set(__self__, "labels", labels)
192
+ if load is not None:
193
+ pulumi.set(__self__, "load", load)
194
+ if network is None:
195
+ network = 'default'
196
+ if network is not None:
197
+ pulumi.set(__self__, "network", network)
198
+ if no_cache is not None:
199
+ pulumi.set(__self__, "no_cache", no_cache)
93
200
  if platforms is not None:
94
201
  pulumi.set(__self__, "platforms", platforms)
95
202
  if pull is not None:
96
203
  pulumi.set(__self__, "pull", pull)
204
+ if push is not None:
205
+ pulumi.set(__self__, "push", push)
97
206
  if registries is not None:
98
207
  pulumi.set(__self__, "registries", registries)
99
208
  if secrets is not None:
100
209
  pulumi.set(__self__, "secrets", secrets)
210
+ if ssh is not None:
211
+ pulumi.set(__self__, "ssh", ssh)
101
212
  if tags is not None:
102
213
  pulumi.set(__self__, "tags", tags)
103
- if targets is not None:
104
- pulumi.set(__self__, "targets", targets)
214
+ if target is not None:
215
+ pulumi.set(__self__, "target", target)
216
+
217
+ @property
218
+ @pulumi.getter(name="addHosts")
219
+ def add_hosts(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
220
+ """
221
+ Custom `host:ip` mappings to use during the build.
222
+
223
+ Equivalent to Docker's `--add-host` flag.
224
+ """
225
+ return pulumi.get(self, "add_hosts")
226
+
227
+ @add_hosts.setter
228
+ def add_hosts(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
229
+ pulumi.set(self, "add_hosts", value)
105
230
 
106
231
  @property
107
232
  @pulumi.getter(name="buildArgs")
@@ -114,6 +239,8 @@ class ImageArgs:
114
239
 
115
240
  Build arguments are persisted in the image, so you should use `secrets`
116
241
  if these arguments are sensitive.
242
+
243
+ Equivalent to Docker's `--build-arg` flag.
117
244
  """
118
245
  return pulumi.get(self, "build_args")
119
246
 
@@ -125,8 +252,20 @@ class ImageArgs:
125
252
  @pulumi.getter(name="buildOnPreview")
126
253
  def build_on_preview(self) -> Optional[pulumi.Input[bool]]:
127
254
  """
128
- When `true`, attempt to build the image during previews. The image will
129
- not be pushed to registries, however caches will still populated.
255
+ By default, preview behavior depends on the execution environment. If
256
+ Pulumi detects the operation is running on a CI system (GitHub Actions,
257
+ Travis CI, Azure Pipelines, etc.) then it will build images during
258
+ previews as a safeguard. Otherwise, if not running on CI, previews will
259
+ not build images.
260
+
261
+ Setting this to `false` forces previews to never perform builds, and
262
+ setting it to `true` will always build the image during previews.
263
+
264
+ Images built during previews are never exported to registries, however
265
+ cache manifests are still exported.
266
+
267
+ On-disk Dockerfiles are always validated for syntactic correctness
268
+ regardless of this setting.
130
269
  """
131
270
  return pulumi.get(self, "build_on_preview")
132
271
 
@@ -148,26 +287,30 @@ class ImageArgs:
148
287
 
149
288
  @property
150
289
  @pulumi.getter(name="cacheFrom")
151
- def cache_from(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['CacheFromEntryArgs']]]]:
290
+ def cache_from(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['CacheFromArgs']]]]:
152
291
  """
153
- External cache configuration.
292
+ Cache export configuration.
293
+
294
+ Equivalent to Docker's `--cache-from` flag.
154
295
  """
155
296
  return pulumi.get(self, "cache_from")
156
297
 
157
298
  @cache_from.setter
158
- def cache_from(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['CacheFromEntryArgs']]]]):
299
+ def cache_from(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['CacheFromArgs']]]]):
159
300
  pulumi.set(self, "cache_from", value)
160
301
 
161
302
  @property
162
303
  @pulumi.getter(name="cacheTo")
163
- def cache_to(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['CacheToEntryArgs']]]]:
304
+ def cache_to(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['CacheToArgs']]]]:
164
305
  """
165
- Cache export configuration.
306
+ Cache import configuration.
307
+
308
+ Equivalent to Docker's `--cache-to` flag.
166
309
  """
167
310
  return pulumi.get(self, "cache_to")
168
311
 
169
312
  @cache_to.setter
170
- def cache_to(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['CacheToEntryArgs']]]]):
313
+ def cache_to(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['CacheToArgs']]]]):
171
314
  pulumi.set(self, "cache_to", value)
172
315
 
173
316
  @property
@@ -175,6 +318,8 @@ class ImageArgs:
175
318
  def context(self) -> Optional[pulumi.Input['BuildContextArgs']]:
176
319
  """
177
320
  Build context settings.
321
+
322
+ Equivalent to Docker's `PATH | URL | -` positional argument.
178
323
  """
179
324
  return pulumi.get(self, "context")
180
325
 
@@ -187,6 +332,8 @@ class ImageArgs:
187
332
  def dockerfile(self) -> Optional[pulumi.Input['DockerfileArgs']]:
188
333
  """
189
334
  Dockerfile settings.
335
+
336
+ Equivalent to Docker's `--file` flag.
190
337
  """
191
338
  return pulumi.get(self, "dockerfile")
192
339
 
@@ -194,19 +341,55 @@ class ImageArgs:
194
341
  def dockerfile(self, value: Optional[pulumi.Input['DockerfileArgs']]):
195
342
  pulumi.set(self, "dockerfile", value)
196
343
 
344
+ @property
345
+ @pulumi.getter(name="exec")
346
+ def exec_(self) -> Optional[pulumi.Input[bool]]:
347
+ """
348
+ Use `exec` mode to build this image.
349
+
350
+ By default the provider embeds a v25 Docker client with v0.12 buildx
351
+ support. This helps ensure consistent behavior across environments and
352
+ is compatible with alternative build backends (e.g. `buildkitd`), but
353
+ it may not be desirable if you require a specific version of buildx.
354
+ For example you may want to run a custom `docker-buildx` binary with
355
+ support for [Docker Build
356
+ Cloud](https://docs.docker.com/build/cloud/setup/) (DBC).
357
+
358
+ When this is set to `true` the provider will instead execute the
359
+ `docker-buildx` binary directly to perform its operations. The user is
360
+ responsible for ensuring this binary exists, with correct permissions
361
+ and pre-configured builders, at a path Docker expects (e.g.
362
+ `~/.docker/cli-plugins`).
363
+
364
+ Debugging `exec` mode may be more difficult as Pulumi will not be able
365
+ to surface fine-grained errors and warnings. Additionally credentials
366
+ are temporarily written to disk in order to provide them to the
367
+ `docker-buildx` binary.
368
+ """
369
+ return pulumi.get(self, "exec_")
370
+
371
+ @exec_.setter
372
+ def exec_(self, value: Optional[pulumi.Input[bool]]):
373
+ pulumi.set(self, "exec_", value)
374
+
197
375
  @property
198
376
  @pulumi.getter
199
- def exports(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ExportEntryArgs']]]]:
377
+ def exports(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ExportArgs']]]]:
200
378
  """
201
379
  Controls where images are persisted after building.
202
380
 
203
381
  Images are only stored in the local cache unless `exports` are
204
382
  explicitly configured.
383
+
384
+ Exporting to multiple destinations requires a daemon running BuildKit
385
+ 0.13 or later.
386
+
387
+ Equivalent to Docker's `--output` flag.
205
388
  """
206
389
  return pulumi.get(self, "exports")
207
390
 
208
391
  @exports.setter
209
- def exports(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ExportEntryArgs']]]]):
392
+ def exports(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ExportArgs']]]]):
210
393
  pulumi.set(self, "exports", value)
211
394
 
212
395
  @property
@@ -214,6 +397,8 @@ class ImageArgs:
214
397
  def labels(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
215
398
  """
216
399
  Attach arbitrary key/value metadata to the image.
400
+
401
+ Equivalent to Docker's `--label` flag.
217
402
  """
218
403
  return pulumi.get(self, "labels")
219
404
 
@@ -221,11 +406,59 @@ class ImageArgs:
221
406
  def labels(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
222
407
  pulumi.set(self, "labels", value)
223
408
 
409
+ @property
410
+ @pulumi.getter
411
+ def load(self) -> Optional[pulumi.Input[bool]]:
412
+ """
413
+ When `true` the build will automatically include a `docker` export.
414
+
415
+ Defaults to `false`.
416
+
417
+ Equivalent to Docker's `--load` flag.
418
+ """
419
+ return pulumi.get(self, "load")
420
+
421
+ @load.setter
422
+ def load(self, value: Optional[pulumi.Input[bool]]):
423
+ pulumi.set(self, "load", value)
424
+
425
+ @property
426
+ @pulumi.getter
427
+ def network(self) -> Optional[pulumi.Input['NetworkMode']]:
428
+ """
429
+ Set the network mode for `RUN` instructions. Defaults to `default`.
430
+
431
+ For custom networks, configure your builder with `--driver-opt network=...`.
432
+
433
+ Equivalent to Docker's `--network` flag.
434
+ """
435
+ return pulumi.get(self, "network")
436
+
437
+ @network.setter
438
+ def network(self, value: Optional[pulumi.Input['NetworkMode']]):
439
+ pulumi.set(self, "network", value)
440
+
441
+ @property
442
+ @pulumi.getter(name="noCache")
443
+ def no_cache(self) -> Optional[pulumi.Input[bool]]:
444
+ """
445
+ Do not import cache manifests when building the image.
446
+
447
+ Equivalent to Docker's `--no-cache` flag.
448
+ """
449
+ return pulumi.get(self, "no_cache")
450
+
451
+ @no_cache.setter
452
+ def no_cache(self, value: Optional[pulumi.Input[bool]]):
453
+ pulumi.set(self, "no_cache", value)
454
+
224
455
  @property
225
456
  @pulumi.getter
226
457
  def platforms(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['Platform']]]]:
227
458
  """
228
- Set target platform(s) for the build. Defaults to the host's platform
459
+ Set target platform(s) for the build. Defaults to the host's platform.
460
+
461
+ Equivalent to Docker's `--platform` flag.
229
462
  """
230
463
  return pulumi.get(self, "platforms")
231
464
 
@@ -238,6 +471,8 @@ class ImageArgs:
238
471
  def pull(self) -> Optional[pulumi.Input[bool]]:
239
472
  """
240
473
  Always pull referenced images.
474
+
475
+ Equivalent to Docker's `--pull` flag.
241
476
  """
242
477
  return pulumi.get(self, "pull")
243
478
 
@@ -245,12 +480,33 @@ class ImageArgs:
245
480
  def pull(self, value: Optional[pulumi.Input[bool]]):
246
481
  pulumi.set(self, "pull", value)
247
482
 
483
+ @property
484
+ @pulumi.getter
485
+ def push(self) -> Optional[pulumi.Input[bool]]:
486
+ """
487
+ When `true` the build will automatically include a `registry` export.
488
+
489
+ Defaults to `false`.
490
+
491
+ Equivalent to Docker's `--push` flag.
492
+ """
493
+ return pulumi.get(self, "push")
494
+
495
+ @push.setter
496
+ def push(self, value: Optional[pulumi.Input[bool]]):
497
+ pulumi.set(self, "push", value)
498
+
248
499
  @property
249
500
  @pulumi.getter
250
501
  def registries(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['RegistryAuthArgs']]]]:
251
502
  """
252
503
  Registry credentials. Required if reading or exporting to private
253
504
  repositories.
505
+
506
+ Credentials are kept in-memory and do not pollute pre-existing
507
+ credentials on the host.
508
+
509
+ Similar to `docker login`.
254
510
  """
255
511
  return pulumi.get(self, "registries")
256
512
 
@@ -269,6 +525,8 @@ class ImageArgs:
269
525
 
270
526
  Build arguments and environment variables are persistent in the final
271
527
  image, so you should use this for sensitive values.
528
+
529
+ Similar to Docker's `--secret` flag.
272
530
  """
273
531
  return pulumi.get(self, "secrets")
274
532
 
@@ -276,6 +534,20 @@ class ImageArgs:
276
534
  def secrets(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
277
535
  pulumi.set(self, "secrets", value)
278
536
 
537
+ @property
538
+ @pulumi.getter
539
+ def ssh(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SSHArgs']]]]:
540
+ """
541
+ SSH agent socket or keys to expose to the build.
542
+
543
+ Equivalent to Docker's `--ssh` flag.
544
+ """
545
+ return pulumi.get(self, "ssh")
546
+
547
+ @ssh.setter
548
+ def ssh(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SSHArgs']]]]):
549
+ pulumi.set(self, "ssh", value)
550
+
279
551
  @property
280
552
  @pulumi.getter
281
553
  def tags(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
@@ -284,6 +556,8 @@ class ImageArgs:
284
556
 
285
557
  If exporting to a registry, the name should include the fully qualified
286
558
  registry address (e.g. `docker.io/pulumi/pulumi:latest`).
559
+
560
+ Equivalent to Docker's `--tag` flag.
287
561
  """
288
562
  return pulumi.get(self, "tags")
289
563
 
@@ -293,17 +567,19 @@ class ImageArgs:
293
567
 
294
568
  @property
295
569
  @pulumi.getter
296
- def targets(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
570
+ def target(self) -> Optional[pulumi.Input[str]]:
297
571
  """
298
572
  Set the target build stage(s) to build.
299
573
 
300
574
  If not specified all targets will be built by default.
575
+
576
+ Equivalent to Docker's `--target` flag.
301
577
  """
302
- return pulumi.get(self, "targets")
578
+ return pulumi.get(self, "target")
303
579
 
304
- @targets.setter
305
- def targets(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
306
- pulumi.set(self, "targets", value)
580
+ @target.setter
581
+ def target(self, value: Optional[pulumi.Input[str]]):
582
+ pulumi.set(self, "target", value)
307
583
 
308
584
 
309
585
  class Image(pulumi.CustomResource):
@@ -311,34 +587,174 @@ class Image(pulumi.CustomResource):
311
587
  def __init__(__self__,
312
588
  resource_name: str,
313
589
  opts: Optional[pulumi.ResourceOptions] = None,
590
+ add_hosts: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
314
591
  build_args: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
315
592
  build_on_preview: Optional[pulumi.Input[bool]] = None,
316
593
  builder: Optional[pulumi.Input[pulumi.InputType['BuilderConfigArgs']]] = None,
317
- cache_from: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromEntryArgs']]]]] = None,
318
- cache_to: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheToEntryArgs']]]]] = None,
594
+ cache_from: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromArgs']]]]] = None,
595
+ cache_to: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheToArgs']]]]] = None,
319
596
  context: Optional[pulumi.Input[pulumi.InputType['BuildContextArgs']]] = None,
320
597
  dockerfile: Optional[pulumi.Input[pulumi.InputType['DockerfileArgs']]] = None,
321
- exports: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportEntryArgs']]]]] = None,
598
+ exec_: Optional[pulumi.Input[bool]] = None,
599
+ exports: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportArgs']]]]] = None,
322
600
  labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
601
+ load: Optional[pulumi.Input[bool]] = None,
602
+ network: Optional[pulumi.Input['NetworkMode']] = None,
603
+ no_cache: Optional[pulumi.Input[bool]] = None,
323
604
  platforms: Optional[pulumi.Input[Sequence[pulumi.Input['Platform']]]] = None,
324
605
  pull: Optional[pulumi.Input[bool]] = None,
606
+ push: Optional[pulumi.Input[bool]] = None,
325
607
  registries: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['RegistryAuthArgs']]]]] = None,
326
608
  secrets: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
609
+ ssh: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['SSHArgs']]]]] = None,
327
610
  tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
328
- targets: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
611
+ target: Optional[pulumi.Input[str]] = None,
329
612
  __props__=None):
330
613
  """
331
614
  A Docker image built using buildx -- Docker's interface to the improved
332
615
  BuildKit backend.
333
616
 
617
+ ## Stability
618
+
334
619
  **This resource is experimental and subject to change.**
335
620
 
336
621
  API types are unstable. Subsequent releases _may_ require manual edits
337
622
  to your state file(s) in order to adopt API changes.
338
623
 
624
+ `retainOnDelete: true` is recommended with this resource until it is
625
+ stable. This enables future API changes to be adopted more easily by renaming
626
+ resources.
627
+
339
628
  Only use this resource if you understand and accept the risks.
340
629
 
630
+ ## Migrating v3 and v4 Image resources
631
+
632
+ The `buildx.Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
633
+ Existing `Image` resources can be converted to `build.Image` resources with minor modifications.
634
+
635
+ ### Behavioral differences
636
+
637
+ There are several key behavioral differences to keep in mind when transitioning images to the new `buildx.Image` resource.
638
+
639
+ #### Previews
640
+
641
+ Version `3.x` of the Pulumi Docker provider always builds images during preview operations.
642
+ This is helpful as a safeguard to prevent "broken" images from merging, but users found the behavior unnecessarily redundant when running previews and updates locally.
643
+
644
+ Version `4.x` changed build-on-preview behavior to be opt-in.
645
+ By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.
646
+ Some users felt this made previews in CI less helpful because they no longer detected bad images by default.
647
+
648
+ The default behavior of the `buildx.Image` resource has been changed to strike a better balance between CI use cases and manual updates.
649
+ By default, Pulumi will now only build `buildx.Image` resources during previews when it detects a CI environment like GitHub Actions.
650
+ Previews run in non-CI environments will not build images.
651
+ This behavior is still configurable with `buildOnPreview`.
652
+
653
+ #### Push behavior
654
+
655
+ Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.
656
+ They expose a `skipPush: true` option to disable pushing.
657
+
658
+ The `buildx.Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
659
+
660
+ To push images to a registry you can include `push: true` (equivalent to Docker's `--push` flag) or configure an `export` of type `registry` (equivalent to Docker's `--output type=registry`).
661
+ Like Docker, if an image is configured without exports you will see a warning with instructions for how to enable pushing, but the build will still proceed normally.
662
+
663
+ #### Secrets
664
+
665
+ Version `3.x` of the Pulumi Docker provider supports secrets by way of the `extraOptions` field.
666
+
667
+ Version `4.x` of the Pulumi Docker provider does not support secrets.
668
+
669
+ The `buildx.Image` resource supports secrets but does not require those secrets to exist on-disk or in environment variables.
670
+ Instead, they should be passed directly as values.
671
+ (Please be sure to familiarize yourself with Pulumi's [native secret handling](https://www.pulumi.com/docs/concepts/secrets/).)
672
+ Pulumi also provides [ESC](https://www.pulumi.com/product/esc/) to make it easier to share secrets across stacks and environments.
673
+
674
+ #### Caching
675
+
676
+ Version `3.x` of the Pulumi Docker provider exposes `cacheFrom: bool | { stages: [...] }`.
677
+ It builds targets individually and pushes them to separate images for caching.
678
+
679
+ Version `4.x` exposes a similar parameter `cacheFrom: { images: [...] }` which pushes and pulls inline caches.
680
+
681
+ Both versions 3 and 4 require specific environment variables to be set and deviate from Docker's native caching behavior.
682
+ This can result in inefficient builds due to unnecessary image pulls, repeated file transfers, etc.
683
+
684
+ The `buildx.Image` resource delegates all caching behavior to Docker.
685
+ `cacheFrom` and `cacheTo` options (equivalent to Docker's `--cache-to` and `--cache-from`) are exposed and provide additional cache targets, such as local disk, S3 storage, etc.
686
+
687
+ #### Outputs
688
+
689
+ Versions `3.x` and `4.x` of the provider exposed a `repoDigest` output which was a fully qualified tag with digest.
690
+ In `4.x` this could also be a single sha256 hash if the image wasn't pushed.
691
+
692
+ Unlike earlier providers the `buildx.Image` resource can push multiple tags.
693
+ As a convenience, it exposes a `ref` output consisting of a tag with digest as long as the image was pushed.
694
+ If multiple tags were pushed this uses one at random.
695
+
696
+ If you need more control over tag references you can use the `digest` output, which is always a single sha256 hash as long as the image was exported somewhere.
697
+
698
+ #### Tag deletion and refreshes
699
+
700
+ Versions 3 and 4 of Pulumi Docker provider do not delete tags when the `Image` resource is deleted, nor do they confirm expected tags exist during `refresh` operations.
701
+
702
+ The `buidx.Image` will query your registries during `refresh` to ensure the expected tags exist.
703
+ If any are missing a subsequent `update` will push them.
704
+
705
+ When a `buildx.Image` is deleted, it will _attempt_ to also delete any pushed tags.
706
+ Deletion of remote tags is not guaranteed because not all registries support the manifest `DELETE` API (`docker.io` in particular).
707
+ Manifests are _not_ deleted in the same way during updates -- to do so safely would require a full build to determine whether a Pulumi operation should be an update or update-replace.
708
+
709
+ Use the [`retainOnDelete: true`](https://www.pulumi.com/docs/concepts/options/retainondelete/) option if you do not want tags deleted.
710
+
711
+ ### Example migration
712
+
713
+ Examples of "fully-featured" `v3` and `v4` `Image` resources are shown below, along with an example `buildx.Image` resource showing how they would look after migration.
714
+
715
+ The `v3` resource leverages `buildx` via a `DOCKER_BUILDKIT` environment variable and CLI flags passed in with `extraOption`.
716
+ After migration, the environment variable is no longer needed and CLI flags are now properties on the `buildx.Image`.
717
+ In almost all cases, properties of `buildx.Image` are named after the Docker CLI flag they correspond to.
718
+
719
+ The `v4` resource is less functional than its `v3` counterpart because it lacks the flexibility of `extraOptions`.
720
+ It it is shown with parameters similar to the `v3` example for completeness.
721
+
341
722
  ## Example Usage
723
+
724
+ ## Example Usage
725
+ ### Push to AWS ECR with caching
726
+ ```python
727
+ import pulumi
728
+ import pulumi_aws as aws
729
+ import pulumi_docker as docker
730
+
731
+ ecr_repository = aws.ecr.Repository("ecr-repository")
732
+ auth_token = aws.ecr.get_authorization_token_output(registry_id=ecr_repository.registry_id)
733
+ my_image = docker.buildx.Image("my-image",
734
+ cache_from=[docker.buildx.CacheFromArgs(
735
+ registry=docker.buildx.CacheFromRegistryArgs(
736
+ ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
737
+ ),
738
+ )],
739
+ cache_to=[docker.buildx.CacheToArgs(
740
+ registry=docker.buildx.CacheToRegistryArgs(
741
+ image_manifest=True,
742
+ oci_media_types=True,
743
+ ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
744
+ ),
745
+ )],
746
+ context=docker.buildx.BuildContextArgs(
747
+ location="./app",
748
+ ),
749
+ push=True,
750
+ registries=[docker.buildx.RegistryAuthArgs(
751
+ address=ecr_repository.repository_url,
752
+ password=auth_token.password,
753
+ username=auth_token.user_name,
754
+ )],
755
+ tags=[ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:latest")])
756
+ pulumi.export("ref", my_image.ref)
757
+ ```
342
758
  ### Multi-platform image
343
759
  ```python
344
760
  import pulumi
@@ -348,9 +764,6 @@ class Image(pulumi.CustomResource):
348
764
  context=docker.buildx.BuildContextArgs(
349
765
  location="app",
350
766
  ),
351
- dockerfile=docker.buildx.DockerfileArgs(
352
- location="app/Dockerfile",
353
- ),
354
767
  platforms=[
355
768
  docker.buildx/image.Platform.PLAN9_AMD64,
356
769
  docker.buildx/image.Platform.PLAN9_386,
@@ -365,19 +778,14 @@ class Image(pulumi.CustomResource):
365
778
  context=docker.buildx.BuildContextArgs(
366
779
  location="app",
367
780
  ),
368
- dockerfile=docker.buildx.DockerfileArgs(
369
- location="app/Dockerfile",
370
- ),
371
- exports=[docker.buildx.ExportEntryArgs(
372
- registry=docker.buildx.ExportRegistryArgs(
373
- oci_media_types=True,
374
- ),
375
- )],
781
+ push=True,
376
782
  registries=[docker.buildx.RegistryAuthArgs(
377
783
  address="docker.io",
378
784
  password=docker_hub_password,
379
785
  username="pulumibot",
380
- )])
786
+ )],
787
+ tags=["docker.io/pulumi/pulumi:3.107.0"])
788
+ pulumi.export("ref", my_image["ref"])
381
789
  ```
382
790
  ### Caching
383
791
  ```python
@@ -385,12 +793,12 @@ class Image(pulumi.CustomResource):
385
793
  import pulumi_docker as docker
386
794
 
387
795
  image = docker.buildx.Image("image",
388
- cache_from=[docker.buildx.CacheFromEntryArgs(
796
+ cache_from=[docker.buildx.CacheFromArgs(
389
797
  local=docker.buildx.CacheFromLocalArgs(
390
798
  src="tmp/cache",
391
799
  ),
392
800
  )],
393
- cache_to=[docker.buildx.CacheToEntryArgs(
801
+ cache_to=[docker.buildx.CacheToArgs(
394
802
  local=docker.buildx.CacheToLocalArgs(
395
803
  dest="tmp/cache",
396
804
  mode=docker.buildx/image.CacheMode.MAX,
@@ -398,11 +806,22 @@ class Image(pulumi.CustomResource):
398
806
  )],
399
807
  context=docker.buildx.BuildContextArgs(
400
808
  location="app",
401
- ),
402
- dockerfile=docker.buildx.DockerfileArgs(
403
- location="app/Dockerfile",
404
809
  ))
405
810
  ```
811
+ ### Docker Build Cloud
812
+ ```python
813
+ import pulumi
814
+ import pulumi_docker as docker
815
+
816
+ image = docker.buildx.Image("image",
817
+ builder=docker.buildx.BuilderConfigArgs(
818
+ name="cloud-builder-name",
819
+ ),
820
+ context=docker.buildx.BuildContextArgs(
821
+ location="app",
822
+ ),
823
+ exec_=True)
824
+ ```
406
825
  ### Build arguments
407
826
  ```python
408
827
  import pulumi
@@ -414,12 +833,9 @@ class Image(pulumi.CustomResource):
414
833
  },
415
834
  context=docker.buildx.BuildContextArgs(
416
835
  location="app",
417
- ),
418
- dockerfile=docker.buildx.DockerfileArgs(
419
- location="app/Dockerfile",
420
836
  ))
421
837
  ```
422
- ### Build targets
838
+ ### Build target
423
839
  ```python
424
840
  import pulumi
425
841
  import pulumi_docker as docker
@@ -428,31 +844,21 @@ class Image(pulumi.CustomResource):
428
844
  context=docker.buildx.BuildContextArgs(
429
845
  location="app",
430
846
  ),
431
- dockerfile=docker.buildx.DockerfileArgs(
432
- location="app/Dockerfile",
433
- ),
434
- targets=[
435
- "build-me",
436
- "also-build-me",
437
- ])
847
+ target="build-me")
438
848
  ```
439
849
  ### Named contexts
440
850
  ```python
441
851
  import pulumi
442
852
  import pulumi_docker as docker
443
853
 
444
- image = docker.buildx.Image("image",
445
- context=docker.buildx.BuildContextArgs(
446
- location="app",
447
- named={
448
- "golang:latest": docker.buildx.ContextArgs(
449
- location="docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
450
- ),
451
- },
452
- ),
453
- dockerfile=docker.buildx.DockerfileArgs(
454
- location="app/Dockerfile",
455
- ))
854
+ image = docker.buildx.Image("image", context=docker.buildx.BuildContextArgs(
855
+ location="app",
856
+ named={
857
+ "golang:latest": docker.buildx.ContextArgs(
858
+ location="docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
859
+ ),
860
+ },
861
+ ))
456
862
  ```
457
863
  ### Remote context
458
864
  ```python
@@ -500,10 +906,7 @@ class Image(pulumi.CustomResource):
500
906
  context=docker.buildx.BuildContextArgs(
501
907
  location="app",
502
908
  ),
503
- dockerfile=docker.buildx.DockerfileArgs(
504
- location="app/Dockerfile",
505
- ),
506
- exports=[docker.buildx.ExportEntryArgs(
909
+ exports=[docker.buildx.ExportArgs(
507
910
  docker=docker.buildx.ExportDockerArgs(
508
911
  tar=True,
509
912
  ),
@@ -512,6 +915,9 @@ class Image(pulumi.CustomResource):
512
915
 
513
916
  :param str resource_name: The name of the resource.
514
917
  :param pulumi.ResourceOptions opts: Options for the resource.
918
+ :param pulumi.Input[Sequence[pulumi.Input[str]]] add_hosts: Custom `host:ip` mappings to use during the build.
919
+
920
+ Equivalent to Docker's `--add-host` flag.
515
921
  :param pulumi.Input[Mapping[str, pulumi.Input[str]]] build_args: `ARG` names and values to set during the build.
516
922
 
517
923
  These variables are accessed like environment variables inside `RUN`
@@ -519,22 +925,98 @@ class Image(pulumi.CustomResource):
519
925
 
520
926
  Build arguments are persisted in the image, so you should use `secrets`
521
927
  if these arguments are sensitive.
522
- :param pulumi.Input[bool] build_on_preview: When `true`, attempt to build the image during previews. The image will
523
- not be pushed to registries, however caches will still populated.
928
+
929
+ Equivalent to Docker's `--build-arg` flag.
930
+ :param pulumi.Input[bool] build_on_preview: By default, preview behavior depends on the execution environment. If
931
+ Pulumi detects the operation is running on a CI system (GitHub Actions,
932
+ Travis CI, Azure Pipelines, etc.) then it will build images during
933
+ previews as a safeguard. Otherwise, if not running on CI, previews will
934
+ not build images.
935
+
936
+ Setting this to `false` forces previews to never perform builds, and
937
+ setting it to `true` will always build the image during previews.
938
+
939
+ Images built during previews are never exported to registries, however
940
+ cache manifests are still exported.
941
+
942
+ On-disk Dockerfiles are always validated for syntactic correctness
943
+ regardless of this setting.
524
944
  :param pulumi.Input[pulumi.InputType['BuilderConfigArgs']] builder: Builder configuration.
525
- :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromEntryArgs']]]] cache_from: External cache configuration.
526
- :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheToEntryArgs']]]] cache_to: Cache export configuration.
945
+ :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromArgs']]]] cache_from: Cache export configuration.
946
+
947
+ Equivalent to Docker's `--cache-from` flag.
948
+ :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheToArgs']]]] cache_to: Cache import configuration.
949
+
950
+ Equivalent to Docker's `--cache-to` flag.
527
951
  :param pulumi.Input[pulumi.InputType['BuildContextArgs']] context: Build context settings.
952
+
953
+ Equivalent to Docker's `PATH | URL | -` positional argument.
528
954
  :param pulumi.Input[pulumi.InputType['DockerfileArgs']] dockerfile: Dockerfile settings.
529
- :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportEntryArgs']]]] exports: Controls where images are persisted after building.
955
+
956
+ Equivalent to Docker's `--file` flag.
957
+ :param pulumi.Input[bool] exec_: Use `exec` mode to build this image.
958
+
959
+ By default the provider embeds a v25 Docker client with v0.12 buildx
960
+ support. This helps ensure consistent behavior across environments and
961
+ is compatible with alternative build backends (e.g. `buildkitd`), but
962
+ it may not be desirable if you require a specific version of buildx.
963
+ For example you may want to run a custom `docker-buildx` binary with
964
+ support for [Docker Build
965
+ Cloud](https://docs.docker.com/build/cloud/setup/) (DBC).
966
+
967
+ When this is set to `true` the provider will instead execute the
968
+ `docker-buildx` binary directly to perform its operations. The user is
969
+ responsible for ensuring this binary exists, with correct permissions
970
+ and pre-configured builders, at a path Docker expects (e.g.
971
+ `~/.docker/cli-plugins`).
972
+
973
+ Debugging `exec` mode may be more difficult as Pulumi will not be able
974
+ to surface fine-grained errors and warnings. Additionally credentials
975
+ are temporarily written to disk in order to provide them to the
976
+ `docker-buildx` binary.
977
+ :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportArgs']]]] exports: Controls where images are persisted after building.
530
978
 
531
979
  Images are only stored in the local cache unless `exports` are
532
980
  explicitly configured.
981
+
982
+ Exporting to multiple destinations requires a daemon running BuildKit
983
+ 0.13 or later.
984
+
985
+ Equivalent to Docker's `--output` flag.
533
986
  :param pulumi.Input[Mapping[str, pulumi.Input[str]]] labels: Attach arbitrary key/value metadata to the image.
534
- :param pulumi.Input[Sequence[pulumi.Input['Platform']]] platforms: Set target platform(s) for the build. Defaults to the host's platform
987
+
988
+ Equivalent to Docker's `--label` flag.
989
+ :param pulumi.Input[bool] load: When `true` the build will automatically include a `docker` export.
990
+
991
+ Defaults to `false`.
992
+
993
+ Equivalent to Docker's `--load` flag.
994
+ :param pulumi.Input['NetworkMode'] network: Set the network mode for `RUN` instructions. Defaults to `default`.
995
+
996
+ For custom networks, configure your builder with `--driver-opt network=...`.
997
+
998
+ Equivalent to Docker's `--network` flag.
999
+ :param pulumi.Input[bool] no_cache: Do not import cache manifests when building the image.
1000
+
1001
+ Equivalent to Docker's `--no-cache` flag.
1002
+ :param pulumi.Input[Sequence[pulumi.Input['Platform']]] platforms: Set target platform(s) for the build. Defaults to the host's platform.
1003
+
1004
+ Equivalent to Docker's `--platform` flag.
535
1005
  :param pulumi.Input[bool] pull: Always pull referenced images.
1006
+
1007
+ Equivalent to Docker's `--pull` flag.
1008
+ :param pulumi.Input[bool] push: When `true` the build will automatically include a `registry` export.
1009
+
1010
+ Defaults to `false`.
1011
+
1012
+ Equivalent to Docker's `--push` flag.
536
1013
  :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['RegistryAuthArgs']]]] registries: Registry credentials. Required if reading or exporting to private
537
1014
  repositories.
1015
+
1016
+ Credentials are kept in-memory and do not pollute pre-existing
1017
+ credentials on the host.
1018
+
1019
+ Similar to `docker login`.
538
1020
  :param pulumi.Input[Mapping[str, pulumi.Input[str]]] secrets: A mapping of secret names to their corresponding values.
539
1021
 
540
1022
  Unlike the Docker CLI, these can be passed by value and do not need to
@@ -542,13 +1024,22 @@ class Image(pulumi.CustomResource):
542
1024
 
543
1025
  Build arguments and environment variables are persistent in the final
544
1026
  image, so you should use this for sensitive values.
1027
+
1028
+ Similar to Docker's `--secret` flag.
1029
+ :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['SSHArgs']]]] ssh: SSH agent socket or keys to expose to the build.
1030
+
1031
+ Equivalent to Docker's `--ssh` flag.
545
1032
  :param pulumi.Input[Sequence[pulumi.Input[str]]] tags: Name and optionally a tag (format: `name:tag`).
546
1033
 
547
1034
  If exporting to a registry, the name should include the fully qualified
548
1035
  registry address (e.g. `docker.io/pulumi/pulumi:latest`).
549
- :param pulumi.Input[Sequence[pulumi.Input[str]]] targets: Set the target build stage(s) to build.
1036
+
1037
+ Equivalent to Docker's `--tag` flag.
1038
+ :param pulumi.Input[str] target: Set the target build stage(s) to build.
550
1039
 
551
1040
  If not specified all targets will be built by default.
1041
+
1042
+ Equivalent to Docker's `--target` flag.
552
1043
  """
553
1044
  ...
554
1045
  @overload
@@ -560,14 +1051,147 @@ class Image(pulumi.CustomResource):
560
1051
  A Docker image built using buildx -- Docker's interface to the improved
561
1052
  BuildKit backend.
562
1053
 
1054
+ ## Stability
1055
+
563
1056
  **This resource is experimental and subject to change.**
564
1057
 
565
1058
  API types are unstable. Subsequent releases _may_ require manual edits
566
1059
  to your state file(s) in order to adopt API changes.
567
1060
 
1061
+ `retainOnDelete: true` is recommended with this resource until it is
1062
+ stable. This enables future API changes to be adopted more easily by renaming
1063
+ resources.
1064
+
568
1065
  Only use this resource if you understand and accept the risks.
569
1066
 
1067
+ ## Migrating v3 and v4 Image resources
1068
+
1069
+ The `buildx.Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
1070
+ Existing `Image` resources can be converted to `build.Image` resources with minor modifications.
1071
+
1072
+ ### Behavioral differences
1073
+
1074
+ There are several key behavioral differences to keep in mind when transitioning images to the new `buildx.Image` resource.
1075
+
1076
+ #### Previews
1077
+
1078
+ Version `3.x` of the Pulumi Docker provider always builds images during preview operations.
1079
+ This is helpful as a safeguard to prevent "broken" images from merging, but users found the behavior unnecessarily redundant when running previews and updates locally.
1080
+
1081
+ Version `4.x` changed build-on-preview behavior to be opt-in.
1082
+ By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.
1083
+ Some users felt this made previews in CI less helpful because they no longer detected bad images by default.
1084
+
1085
+ The default behavior of the `buildx.Image` resource has been changed to strike a better balance between CI use cases and manual updates.
1086
+ By default, Pulumi will now only build `buildx.Image` resources during previews when it detects a CI environment like GitHub Actions.
1087
+ Previews run in non-CI environments will not build images.
1088
+ This behavior is still configurable with `buildOnPreview`.
1089
+
1090
+ #### Push behavior
1091
+
1092
+ Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.
1093
+ They expose a `skipPush: true` option to disable pushing.
1094
+
1095
+ The `buildx.Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
1096
+
1097
+ To push images to a registry you can include `push: true` (equivalent to Docker's `--push` flag) or configure an `export` of type `registry` (equivalent to Docker's `--output type=registry`).
1098
+ Like Docker, if an image is configured without exports you will see a warning with instructions for how to enable pushing, but the build will still proceed normally.
1099
+
1100
+ #### Secrets
1101
+
1102
+ Version `3.x` of the Pulumi Docker provider supports secrets by way of the `extraOptions` field.
1103
+
1104
+ Version `4.x` of the Pulumi Docker provider does not support secrets.
1105
+
1106
+ The `buildx.Image` resource supports secrets but does not require those secrets to exist on-disk or in environment variables.
1107
+ Instead, they should be passed directly as values.
1108
+ (Please be sure to familiarize yourself with Pulumi's [native secret handling](https://www.pulumi.com/docs/concepts/secrets/).)
1109
+ Pulumi also provides [ESC](https://www.pulumi.com/product/esc/) to make it easier to share secrets across stacks and environments.
1110
+
1111
+ #### Caching
1112
+
1113
+ Version `3.x` of the Pulumi Docker provider exposes `cacheFrom: bool | { stages: [...] }`.
1114
+ It builds targets individually and pushes them to separate images for caching.
1115
+
1116
+ Version `4.x` exposes a similar parameter `cacheFrom: { images: [...] }` which pushes and pulls inline caches.
1117
+
1118
+ Both versions 3 and 4 require specific environment variables to be set and deviate from Docker's native caching behavior.
1119
+ This can result in inefficient builds due to unnecessary image pulls, repeated file transfers, etc.
1120
+
1121
+ The `buildx.Image` resource delegates all caching behavior to Docker.
1122
+ `cacheFrom` and `cacheTo` options (equivalent to Docker's `--cache-to` and `--cache-from`) are exposed and provide additional cache targets, such as local disk, S3 storage, etc.
1123
+
1124
+ #### Outputs
1125
+
1126
+ Versions `3.x` and `4.x` of the provider exposed a `repoDigest` output which was a fully qualified tag with digest.
1127
+ In `4.x` this could also be a single sha256 hash if the image wasn't pushed.
1128
+
1129
+ Unlike earlier providers the `buildx.Image` resource can push multiple tags.
1130
+ As a convenience, it exposes a `ref` output consisting of a tag with digest as long as the image was pushed.
1131
+ If multiple tags were pushed this uses one at random.
1132
+
1133
+ If you need more control over tag references you can use the `digest` output, which is always a single sha256 hash as long as the image was exported somewhere.
1134
+
1135
+ #### Tag deletion and refreshes
1136
+
1137
+ Versions 3 and 4 of Pulumi Docker provider do not delete tags when the `Image` resource is deleted, nor do they confirm expected tags exist during `refresh` operations.
1138
+
1139
+ The `buidx.Image` will query your registries during `refresh` to ensure the expected tags exist.
1140
+ If any are missing a subsequent `update` will push them.
1141
+
1142
+ When a `buildx.Image` is deleted, it will _attempt_ to also delete any pushed tags.
1143
+ Deletion of remote tags is not guaranteed because not all registries support the manifest `DELETE` API (`docker.io` in particular).
1144
+ Manifests are _not_ deleted in the same way during updates -- to do so safely would require a full build to determine whether a Pulumi operation should be an update or update-replace.
1145
+
1146
+ Use the [`retainOnDelete: true`](https://www.pulumi.com/docs/concepts/options/retainondelete/) option if you do not want tags deleted.
1147
+
1148
+ ### Example migration
1149
+
1150
+ Examples of "fully-featured" `v3` and `v4` `Image` resources are shown below, along with an example `buildx.Image` resource showing how they would look after migration.
1151
+
1152
+ The `v3` resource leverages `buildx` via a `DOCKER_BUILDKIT` environment variable and CLI flags passed in with `extraOption`.
1153
+ After migration, the environment variable is no longer needed and CLI flags are now properties on the `buildx.Image`.
1154
+ In almost all cases, properties of `buildx.Image` are named after the Docker CLI flag they correspond to.
1155
+
1156
+ The `v4` resource is less functional than its `v3` counterpart because it lacks the flexibility of `extraOptions`.
1157
+ It it is shown with parameters similar to the `v3` example for completeness.
1158
+
1159
+ ## Example Usage
1160
+
570
1161
  ## Example Usage
1162
+ ### Push to AWS ECR with caching
1163
+ ```python
1164
+ import pulumi
1165
+ import pulumi_aws as aws
1166
+ import pulumi_docker as docker
1167
+
1168
+ ecr_repository = aws.ecr.Repository("ecr-repository")
1169
+ auth_token = aws.ecr.get_authorization_token_output(registry_id=ecr_repository.registry_id)
1170
+ my_image = docker.buildx.Image("my-image",
1171
+ cache_from=[docker.buildx.CacheFromArgs(
1172
+ registry=docker.buildx.CacheFromRegistryArgs(
1173
+ ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
1174
+ ),
1175
+ )],
1176
+ cache_to=[docker.buildx.CacheToArgs(
1177
+ registry=docker.buildx.CacheToRegistryArgs(
1178
+ image_manifest=True,
1179
+ oci_media_types=True,
1180
+ ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
1181
+ ),
1182
+ )],
1183
+ context=docker.buildx.BuildContextArgs(
1184
+ location="./app",
1185
+ ),
1186
+ push=True,
1187
+ registries=[docker.buildx.RegistryAuthArgs(
1188
+ address=ecr_repository.repository_url,
1189
+ password=auth_token.password,
1190
+ username=auth_token.user_name,
1191
+ )],
1192
+ tags=[ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:latest")])
1193
+ pulumi.export("ref", my_image.ref)
1194
+ ```
571
1195
  ### Multi-platform image
572
1196
  ```python
573
1197
  import pulumi
@@ -577,9 +1201,6 @@ class Image(pulumi.CustomResource):
577
1201
  context=docker.buildx.BuildContextArgs(
578
1202
  location="app",
579
1203
  ),
580
- dockerfile=docker.buildx.DockerfileArgs(
581
- location="app/Dockerfile",
582
- ),
583
1204
  platforms=[
584
1205
  docker.buildx/image.Platform.PLAN9_AMD64,
585
1206
  docker.buildx/image.Platform.PLAN9_386,
@@ -594,19 +1215,14 @@ class Image(pulumi.CustomResource):
594
1215
  context=docker.buildx.BuildContextArgs(
595
1216
  location="app",
596
1217
  ),
597
- dockerfile=docker.buildx.DockerfileArgs(
598
- location="app/Dockerfile",
599
- ),
600
- exports=[docker.buildx.ExportEntryArgs(
601
- registry=docker.buildx.ExportRegistryArgs(
602
- oci_media_types=True,
603
- ),
604
- )],
1218
+ push=True,
605
1219
  registries=[docker.buildx.RegistryAuthArgs(
606
1220
  address="docker.io",
607
1221
  password=docker_hub_password,
608
1222
  username="pulumibot",
609
- )])
1223
+ )],
1224
+ tags=["docker.io/pulumi/pulumi:3.107.0"])
1225
+ pulumi.export("ref", my_image["ref"])
610
1226
  ```
611
1227
  ### Caching
612
1228
  ```python
@@ -614,12 +1230,12 @@ class Image(pulumi.CustomResource):
614
1230
  import pulumi_docker as docker
615
1231
 
616
1232
  image = docker.buildx.Image("image",
617
- cache_from=[docker.buildx.CacheFromEntryArgs(
1233
+ cache_from=[docker.buildx.CacheFromArgs(
618
1234
  local=docker.buildx.CacheFromLocalArgs(
619
1235
  src="tmp/cache",
620
1236
  ),
621
1237
  )],
622
- cache_to=[docker.buildx.CacheToEntryArgs(
1238
+ cache_to=[docker.buildx.CacheToArgs(
623
1239
  local=docker.buildx.CacheToLocalArgs(
624
1240
  dest="tmp/cache",
625
1241
  mode=docker.buildx/image.CacheMode.MAX,
@@ -627,11 +1243,22 @@ class Image(pulumi.CustomResource):
627
1243
  )],
628
1244
  context=docker.buildx.BuildContextArgs(
629
1245
  location="app",
630
- ),
631
- dockerfile=docker.buildx.DockerfileArgs(
632
- location="app/Dockerfile",
633
1246
  ))
634
1247
  ```
1248
+ ### Docker Build Cloud
1249
+ ```python
1250
+ import pulumi
1251
+ import pulumi_docker as docker
1252
+
1253
+ image = docker.buildx.Image("image",
1254
+ builder=docker.buildx.BuilderConfigArgs(
1255
+ name="cloud-builder-name",
1256
+ ),
1257
+ context=docker.buildx.BuildContextArgs(
1258
+ location="app",
1259
+ ),
1260
+ exec_=True)
1261
+ ```
635
1262
  ### Build arguments
636
1263
  ```python
637
1264
  import pulumi
@@ -643,12 +1270,9 @@ class Image(pulumi.CustomResource):
643
1270
  },
644
1271
  context=docker.buildx.BuildContextArgs(
645
1272
  location="app",
646
- ),
647
- dockerfile=docker.buildx.DockerfileArgs(
648
- location="app/Dockerfile",
649
1273
  ))
650
1274
  ```
651
- ### Build targets
1275
+ ### Build target
652
1276
  ```python
653
1277
  import pulumi
654
1278
  import pulumi_docker as docker
@@ -657,31 +1281,21 @@ class Image(pulumi.CustomResource):
657
1281
  context=docker.buildx.BuildContextArgs(
658
1282
  location="app",
659
1283
  ),
660
- dockerfile=docker.buildx.DockerfileArgs(
661
- location="app/Dockerfile",
662
- ),
663
- targets=[
664
- "build-me",
665
- "also-build-me",
666
- ])
1284
+ target="build-me")
667
1285
  ```
668
1286
  ### Named contexts
669
1287
  ```python
670
1288
  import pulumi
671
1289
  import pulumi_docker as docker
672
1290
 
673
- image = docker.buildx.Image("image",
674
- context=docker.buildx.BuildContextArgs(
675
- location="app",
676
- named={
677
- "golang:latest": docker.buildx.ContextArgs(
678
- location="docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
679
- ),
680
- },
681
- ),
682
- dockerfile=docker.buildx.DockerfileArgs(
683
- location="app/Dockerfile",
684
- ))
1291
+ image = docker.buildx.Image("image", context=docker.buildx.BuildContextArgs(
1292
+ location="app",
1293
+ named={
1294
+ "golang:latest": docker.buildx.ContextArgs(
1295
+ location="docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
1296
+ ),
1297
+ },
1298
+ ))
685
1299
  ```
686
1300
  ### Remote context
687
1301
  ```python
@@ -729,10 +1343,7 @@ class Image(pulumi.CustomResource):
729
1343
  context=docker.buildx.BuildContextArgs(
730
1344
  location="app",
731
1345
  ),
732
- dockerfile=docker.buildx.DockerfileArgs(
733
- location="app/Dockerfile",
734
- ),
735
- exports=[docker.buildx.ExportEntryArgs(
1346
+ exports=[docker.buildx.ExportArgs(
736
1347
  docker=docker.buildx.ExportDockerArgs(
737
1348
  tar=True,
738
1349
  ),
@@ -754,21 +1365,28 @@ class Image(pulumi.CustomResource):
754
1365
  def _internal_init(__self__,
755
1366
  resource_name: str,
756
1367
  opts: Optional[pulumi.ResourceOptions] = None,
1368
+ add_hosts: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
757
1369
  build_args: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
758
1370
  build_on_preview: Optional[pulumi.Input[bool]] = None,
759
1371
  builder: Optional[pulumi.Input[pulumi.InputType['BuilderConfigArgs']]] = None,
760
- cache_from: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromEntryArgs']]]]] = None,
761
- cache_to: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheToEntryArgs']]]]] = None,
1372
+ cache_from: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromArgs']]]]] = None,
1373
+ cache_to: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheToArgs']]]]] = None,
762
1374
  context: Optional[pulumi.Input[pulumi.InputType['BuildContextArgs']]] = None,
763
1375
  dockerfile: Optional[pulumi.Input[pulumi.InputType['DockerfileArgs']]] = None,
764
- exports: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportEntryArgs']]]]] = None,
1376
+ exec_: Optional[pulumi.Input[bool]] = None,
1377
+ exports: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportArgs']]]]] = None,
765
1378
  labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
1379
+ load: Optional[pulumi.Input[bool]] = None,
1380
+ network: Optional[pulumi.Input['NetworkMode']] = None,
1381
+ no_cache: Optional[pulumi.Input[bool]] = None,
766
1382
  platforms: Optional[pulumi.Input[Sequence[pulumi.Input['Platform']]]] = None,
767
1383
  pull: Optional[pulumi.Input[bool]] = None,
1384
+ push: Optional[pulumi.Input[bool]] = None,
768
1385
  registries: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['RegistryAuthArgs']]]]] = None,
769
1386
  secrets: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
1387
+ ssh: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['SSHArgs']]]]] = None,
770
1388
  tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
771
- targets: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
1389
+ target: Optional[pulumi.Input[str]] = None,
772
1390
  __props__=None):
773
1391
  opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
774
1392
  if not isinstance(opts, pulumi.ResourceOptions):
@@ -778,6 +1396,7 @@ class Image(pulumi.CustomResource):
778
1396
  raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
779
1397
  __props__ = ImageArgs.__new__(ImageArgs)
780
1398
 
1399
+ __props__.__dict__["add_hosts"] = add_hosts
781
1400
  __props__.__dict__["build_args"] = build_args
782
1401
  __props__.__dict__["build_on_preview"] = build_on_preview
783
1402
  __props__.__dict__["builder"] = builder
@@ -785,18 +1404,25 @@ class Image(pulumi.CustomResource):
785
1404
  __props__.__dict__["cache_to"] = cache_to
786
1405
  __props__.__dict__["context"] = context
787
1406
  __props__.__dict__["dockerfile"] = dockerfile
1407
+ __props__.__dict__["exec_"] = exec_
788
1408
  __props__.__dict__["exports"] = exports
789
1409
  __props__.__dict__["labels"] = labels
1410
+ __props__.__dict__["load"] = load
1411
+ if network is None:
1412
+ network = 'default'
1413
+ __props__.__dict__["network"] = network
1414
+ __props__.__dict__["no_cache"] = no_cache
790
1415
  __props__.__dict__["platforms"] = platforms
791
1416
  __props__.__dict__["pull"] = pull
1417
+ __props__.__dict__["push"] = push
792
1418
  __props__.__dict__["registries"] = registries
793
- __props__.__dict__["secrets"] = None if secrets is None else pulumi.Output.secret(secrets)
1419
+ __props__.__dict__["secrets"] = secrets
1420
+ __props__.__dict__["ssh"] = ssh
794
1421
  __props__.__dict__["tags"] = tags
795
- __props__.__dict__["targets"] = targets
1422
+ __props__.__dict__["target"] = target
796
1423
  __props__.__dict__["context_hash"] = None
797
- __props__.__dict__["digests"] = None
798
- secret_opts = pulumi.ResourceOptions(additional_secret_outputs=["secrets"])
799
- opts = pulumi.ResourceOptions.merge(opts, secret_opts)
1424
+ __props__.__dict__["digest"] = None
1425
+ __props__.__dict__["ref"] = None
800
1426
  super(Image, __self__).__init__(
801
1427
  'docker:buildx/image:Image',
802
1428
  resource_name,
@@ -819,6 +1445,7 @@ class Image(pulumi.CustomResource):
819
1445
 
820
1446
  __props__ = ImageArgs.__new__(ImageArgs)
821
1447
 
1448
+ __props__.__dict__["add_hosts"] = None
822
1449
  __props__.__dict__["build_args"] = None
823
1450
  __props__.__dict__["build_on_preview"] = None
824
1451
  __props__.__dict__["builder"] = None
@@ -826,18 +1453,35 @@ class Image(pulumi.CustomResource):
826
1453
  __props__.__dict__["cache_to"] = None
827
1454
  __props__.__dict__["context"] = None
828
1455
  __props__.__dict__["context_hash"] = None
829
- __props__.__dict__["digests"] = None
1456
+ __props__.__dict__["digest"] = None
830
1457
  __props__.__dict__["dockerfile"] = None
1458
+ __props__.__dict__["exec_"] = None
831
1459
  __props__.__dict__["exports"] = None
832
1460
  __props__.__dict__["labels"] = None
1461
+ __props__.__dict__["load"] = None
1462
+ __props__.__dict__["network"] = None
1463
+ __props__.__dict__["no_cache"] = None
833
1464
  __props__.__dict__["platforms"] = None
834
1465
  __props__.__dict__["pull"] = None
1466
+ __props__.__dict__["push"] = None
1467
+ __props__.__dict__["ref"] = None
835
1468
  __props__.__dict__["registries"] = None
836
1469
  __props__.__dict__["secrets"] = None
1470
+ __props__.__dict__["ssh"] = None
837
1471
  __props__.__dict__["tags"] = None
838
- __props__.__dict__["targets"] = None
1472
+ __props__.__dict__["target"] = None
839
1473
  return Image(resource_name, opts=opts, __props__=__props__)
840
1474
 
1475
+ @property
1476
+ @pulumi.getter(name="addHosts")
1477
+ def add_hosts(self) -> pulumi.Output[Optional[Sequence[str]]]:
1478
+ """
1479
+ Custom `host:ip` mappings to use during the build.
1480
+
1481
+ Equivalent to Docker's `--add-host` flag.
1482
+ """
1483
+ return pulumi.get(self, "add_hosts")
1484
+
841
1485
  @property
842
1486
  @pulumi.getter(name="buildArgs")
843
1487
  def build_args(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
@@ -849,6 +1493,8 @@ class Image(pulumi.CustomResource):
849
1493
 
850
1494
  Build arguments are persisted in the image, so you should use `secrets`
851
1495
  if these arguments are sensitive.
1496
+
1497
+ Equivalent to Docker's `--build-arg` flag.
852
1498
  """
853
1499
  return pulumi.get(self, "build_args")
854
1500
 
@@ -856,8 +1502,20 @@ class Image(pulumi.CustomResource):
856
1502
  @pulumi.getter(name="buildOnPreview")
857
1503
  def build_on_preview(self) -> pulumi.Output[Optional[bool]]:
858
1504
  """
859
- When `true`, attempt to build the image during previews. The image will
860
- not be pushed to registries, however caches will still populated.
1505
+ By default, preview behavior depends on the execution environment. If
1506
+ Pulumi detects the operation is running on a CI system (GitHub Actions,
1507
+ Travis CI, Azure Pipelines, etc.) then it will build images during
1508
+ previews as a safeguard. Otherwise, if not running on CI, previews will
1509
+ not build images.
1510
+
1511
+ Setting this to `false` forces previews to never perform builds, and
1512
+ setting it to `true` will always build the image during previews.
1513
+
1514
+ Images built during previews are never exported to registries, however
1515
+ cache manifests are still exported.
1516
+
1517
+ On-disk Dockerfiles are always validated for syntactic correctness
1518
+ regardless of this setting.
861
1519
  """
862
1520
  return pulumi.get(self, "build_on_preview")
863
1521
 
@@ -871,17 +1529,21 @@ class Image(pulumi.CustomResource):
871
1529
 
872
1530
  @property
873
1531
  @pulumi.getter(name="cacheFrom")
874
- def cache_from(self) -> pulumi.Output[Optional[Sequence['outputs.CacheFromEntry']]]:
1532
+ def cache_from(self) -> pulumi.Output[Optional[Sequence['outputs.CacheFrom']]]:
875
1533
  """
876
- External cache configuration.
1534
+ Cache export configuration.
1535
+
1536
+ Equivalent to Docker's `--cache-from` flag.
877
1537
  """
878
1538
  return pulumi.get(self, "cache_from")
879
1539
 
880
1540
  @property
881
1541
  @pulumi.getter(name="cacheTo")
882
- def cache_to(self) -> pulumi.Output[Optional[Sequence['outputs.CacheToEntry']]]:
1542
+ def cache_to(self) -> pulumi.Output[Optional[Sequence['outputs.CacheTo']]]:
883
1543
  """
884
- Cache export configuration.
1544
+ Cache import configuration.
1545
+
1546
+ Equivalent to Docker's `--cache-to` flag.
885
1547
  """
886
1548
  return pulumi.get(self, "cache_to")
887
1549
 
@@ -890,12 +1552,14 @@ class Image(pulumi.CustomResource):
890
1552
  def context(self) -> pulumi.Output[Optional['outputs.BuildContext']]:
891
1553
  """
892
1554
  Build context settings.
1555
+
1556
+ Equivalent to Docker's `PATH | URL | -` positional argument.
893
1557
  """
894
1558
  return pulumi.get(self, "context")
895
1559
 
896
1560
  @property
897
1561
  @pulumi.getter(name="contextHash")
898
- def context_hash(self) -> pulumi.Output[Optional[str]]:
1562
+ def context_hash(self) -> pulumi.Output[str]:
899
1563
  """
900
1564
  A preliminary hash of the image's build context.
901
1565
 
@@ -905,28 +1569,68 @@ class Image(pulumi.CustomResource):
905
1569
 
906
1570
  @property
907
1571
  @pulumi.getter
908
- def digests(self) -> pulumi.Output[Optional[Mapping[str, Sequence[str]]]]:
1572
+ def digest(self) -> pulumi.Output[str]:
909
1573
  """
910
- A mapping of platform type to refs which were pushed to registries.
1574
+ A SHA256 digest of the image if it was exported to a registry or
1575
+ elsewhere.
1576
+
1577
+ Empty if the image was not exported.
1578
+
1579
+ Registry images can be referenced precisely as `<tag>@<digest>`. The
1580
+ `ref` output provides one such reference as a convenience.
911
1581
  """
912
- return pulumi.get(self, "digests")
1582
+ return pulumi.get(self, "digest")
913
1583
 
914
1584
  @property
915
1585
  @pulumi.getter
916
1586
  def dockerfile(self) -> pulumi.Output[Optional['outputs.Dockerfile']]:
917
1587
  """
918
1588
  Dockerfile settings.
1589
+
1590
+ Equivalent to Docker's `--file` flag.
919
1591
  """
920
1592
  return pulumi.get(self, "dockerfile")
921
1593
 
1594
+ @property
1595
+ @pulumi.getter(name="exec")
1596
+ def exec_(self) -> pulumi.Output[Optional[bool]]:
1597
+ """
1598
+ Use `exec` mode to build this image.
1599
+
1600
+ By default the provider embeds a v25 Docker client with v0.12 buildx
1601
+ support. This helps ensure consistent behavior across environments and
1602
+ is compatible with alternative build backends (e.g. `buildkitd`), but
1603
+ it may not be desirable if you require a specific version of buildx.
1604
+ For example you may want to run a custom `docker-buildx` binary with
1605
+ support for [Docker Build
1606
+ Cloud](https://docs.docker.com/build/cloud/setup/) (DBC).
1607
+
1608
+ When this is set to `true` the provider will instead execute the
1609
+ `docker-buildx` binary directly to perform its operations. The user is
1610
+ responsible for ensuring this binary exists, with correct permissions
1611
+ and pre-configured builders, at a path Docker expects (e.g.
1612
+ `~/.docker/cli-plugins`).
1613
+
1614
+ Debugging `exec` mode may be more difficult as Pulumi will not be able
1615
+ to surface fine-grained errors and warnings. Additionally credentials
1616
+ are temporarily written to disk in order to provide them to the
1617
+ `docker-buildx` binary.
1618
+ """
1619
+ return pulumi.get(self, "exec_")
1620
+
922
1621
  @property
923
1622
  @pulumi.getter
924
- def exports(self) -> pulumi.Output[Optional[Sequence['outputs.ExportEntry']]]:
1623
+ def exports(self) -> pulumi.Output[Optional[Sequence['outputs.Export']]]:
925
1624
  """
926
1625
  Controls where images are persisted after building.
927
1626
 
928
1627
  Images are only stored in the local cache unless `exports` are
929
1628
  explicitly configured.
1629
+
1630
+ Exporting to multiple destinations requires a daemon running BuildKit
1631
+ 0.13 or later.
1632
+
1633
+ Equivalent to Docker's `--output` flag.
930
1634
  """
931
1635
  return pulumi.get(self, "exports")
932
1636
 
@@ -935,14 +1639,52 @@ class Image(pulumi.CustomResource):
935
1639
  def labels(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
936
1640
  """
937
1641
  Attach arbitrary key/value metadata to the image.
1642
+
1643
+ Equivalent to Docker's `--label` flag.
938
1644
  """
939
1645
  return pulumi.get(self, "labels")
940
1646
 
1647
+ @property
1648
+ @pulumi.getter
1649
+ def load(self) -> pulumi.Output[Optional[bool]]:
1650
+ """
1651
+ When `true` the build will automatically include a `docker` export.
1652
+
1653
+ Defaults to `false`.
1654
+
1655
+ Equivalent to Docker's `--load` flag.
1656
+ """
1657
+ return pulumi.get(self, "load")
1658
+
1659
+ @property
1660
+ @pulumi.getter
1661
+ def network(self) -> pulumi.Output[Optional['NetworkMode']]:
1662
+ """
1663
+ Set the network mode for `RUN` instructions. Defaults to `default`.
1664
+
1665
+ For custom networks, configure your builder with `--driver-opt network=...`.
1666
+
1667
+ Equivalent to Docker's `--network` flag.
1668
+ """
1669
+ return pulumi.get(self, "network")
1670
+
1671
+ @property
1672
+ @pulumi.getter(name="noCache")
1673
+ def no_cache(self) -> pulumi.Output[Optional[bool]]:
1674
+ """
1675
+ Do not import cache manifests when building the image.
1676
+
1677
+ Equivalent to Docker's `--no-cache` flag.
1678
+ """
1679
+ return pulumi.get(self, "no_cache")
1680
+
941
1681
  @property
942
1682
  @pulumi.getter
943
1683
  def platforms(self) -> pulumi.Output[Optional[Sequence['Platform']]]:
944
1684
  """
945
- Set target platform(s) for the build. Defaults to the host's platform
1685
+ Set target platform(s) for the build. Defaults to the host's platform.
1686
+
1687
+ Equivalent to Docker's `--platform` flag.
946
1688
  """
947
1689
  return pulumi.get(self, "platforms")
948
1690
 
@@ -951,15 +1693,55 @@ class Image(pulumi.CustomResource):
951
1693
  def pull(self) -> pulumi.Output[Optional[bool]]:
952
1694
  """
953
1695
  Always pull referenced images.
1696
+
1697
+ Equivalent to Docker's `--pull` flag.
954
1698
  """
955
1699
  return pulumi.get(self, "pull")
956
1700
 
1701
+ @property
1702
+ @pulumi.getter
1703
+ def push(self) -> pulumi.Output[Optional[bool]]:
1704
+ """
1705
+ When `true` the build will automatically include a `registry` export.
1706
+
1707
+ Defaults to `false`.
1708
+
1709
+ Equivalent to Docker's `--push` flag.
1710
+ """
1711
+ return pulumi.get(self, "push")
1712
+
1713
+ @property
1714
+ @pulumi.getter
1715
+ def ref(self) -> pulumi.Output[str]:
1716
+ """
1717
+ If the image was pushed to any registries then this will contain a
1718
+ single fully-qualified tag including the build's digest.
1719
+
1720
+ If the image had tags but was not exported, this will take on a value
1721
+ of one of those tags.
1722
+
1723
+ This will be empty if the image had no exports and no tags.
1724
+
1725
+ This is only for convenience and may not be appropriate for situations
1726
+ where multiple tags or registries are involved. In those cases this
1727
+ output is not guaranteed to be stable.
1728
+
1729
+ For more control over tags consumed by downstream resources you should
1730
+ use the `digest` output.
1731
+ """
1732
+ return pulumi.get(self, "ref")
1733
+
957
1734
  @property
958
1735
  @pulumi.getter
959
1736
  def registries(self) -> pulumi.Output[Optional[Sequence['outputs.RegistryAuth']]]:
960
1737
  """
961
1738
  Registry credentials. Required if reading or exporting to private
962
1739
  repositories.
1740
+
1741
+ Credentials are kept in-memory and do not pollute pre-existing
1742
+ credentials on the host.
1743
+
1744
+ Similar to `docker login`.
963
1745
  """
964
1746
  return pulumi.get(self, "registries")
965
1747
 
@@ -974,9 +1756,21 @@ class Image(pulumi.CustomResource):
974
1756
 
975
1757
  Build arguments and environment variables are persistent in the final
976
1758
  image, so you should use this for sensitive values.
1759
+
1760
+ Similar to Docker's `--secret` flag.
977
1761
  """
978
1762
  return pulumi.get(self, "secrets")
979
1763
 
1764
+ @property
1765
+ @pulumi.getter
1766
+ def ssh(self) -> pulumi.Output[Optional[Sequence['outputs.SSH']]]:
1767
+ """
1768
+ SSH agent socket or keys to expose to the build.
1769
+
1770
+ Equivalent to Docker's `--ssh` flag.
1771
+ """
1772
+ return pulumi.get(self, "ssh")
1773
+
980
1774
  @property
981
1775
  @pulumi.getter
982
1776
  def tags(self) -> pulumi.Output[Optional[Sequence[str]]]:
@@ -985,16 +1779,20 @@ class Image(pulumi.CustomResource):
985
1779
 
986
1780
  If exporting to a registry, the name should include the fully qualified
987
1781
  registry address (e.g. `docker.io/pulumi/pulumi:latest`).
1782
+
1783
+ Equivalent to Docker's `--tag` flag.
988
1784
  """
989
1785
  return pulumi.get(self, "tags")
990
1786
 
991
1787
  @property
992
1788
  @pulumi.getter
993
- def targets(self) -> pulumi.Output[Optional[Sequence[str]]]:
1789
+ def target(self) -> pulumi.Output[Optional[str]]:
994
1790
  """
995
1791
  Set the target build stage(s) to build.
996
1792
 
997
1793
  If not specified all targets will be built by default.
1794
+
1795
+ Equivalent to Docker's `--target` flag.
998
1796
  """
999
- return pulumi.get(self, "targets")
1797
+ return pulumi.get(self, "target")
1000
1798