1. Packages
  2. AWSx (Pulumi Crosswalk for AWS)
  3. API Docs
  4. ecr
  5. Image
AWSx (Pulumi Crosswalk for AWS) v2.21.1 published on Monday, Mar 10, 2025 by Pulumi

awsx.ecr.Image

Explore with Pulumi AI

AWSx (Pulumi Crosswalk for AWS) v2.21.1 published on Monday, Mar 10, 2025 by Pulumi

Builds a docker image and pushes to the ECR repository

Create Image Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Image(name: string, args: ImageArgs, opts?: ComponentResourceOptions);
@overload
def Image(resource_name: str,
          args: ImageArgs,
          opts: Optional[ResourceOptions] = None)

@overload
def Image(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          repository_url: Optional[str] = None,
          args: Optional[Mapping[str, str]] = None,
          builder_version: Optional[BuilderVersion] = None,
          cache_from: Optional[Sequence[str]] = None,
          context: Optional[str] = None,
          dockerfile: Optional[str] = None,
          image_name: Optional[str] = None,
          image_tag: Optional[str] = None,
          platform: Optional[str] = None,
          registry_id: Optional[str] = None,
          target: Optional[str] = None)
func NewImage(ctx *Context, name string, args ImageArgs, opts ...ResourceOption) (*Image, error)
public Image(string name, ImageArgs args, ComponentResourceOptions? opts = null)
public Image(String name, ImageArgs args)
public Image(String name, ImageArgs args, ComponentResourceOptions options)
type: awsx:ecr:Image
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ImageArgs
The arguments to resource properties.
opts ComponentResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ImageArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ImageArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ImageArgs
The arguments to resource properties.
opts ComponentResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ImageArgs
The arguments to resource properties.
options ComponentResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var imageResource = new Awsx.Ecr.Image("imageResource", new()
{
    RepositoryUrl = "string",
    Args = 
    {
        { "string", "string" },
    },
    BuilderVersion = Awsx.Ecr.BuilderVersion.BuilderV1,
    CacheFrom = new[]
    {
        "string",
    },
    Context = "string",
    Dockerfile = "string",
    ImageName = "string",
    ImageTag = "string",
    Platform = "string",
    RegistryId = "string",
    Target = "string",
});
Copy
example, err := ecr.NewImage(ctx, "imageResource", &ecr.ImageArgs{
	RepositoryUrl: pulumi.String("string"),
	Args: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	BuilderVersion: ecr.BuilderVersionBuilderV1,
	CacheFrom: pulumi.StringArray{
		pulumi.String("string"),
	},
	Context:    pulumi.String("string"),
	Dockerfile: pulumi.String("string"),
	ImageName:  pulumi.String("string"),
	ImageTag:   pulumi.String("string"),
	Platform:   pulumi.String("string"),
	RegistryId: pulumi.String("string"),
	Target:     pulumi.String("string"),
})
Copy
var imageResource = new Image("imageResource", ImageArgs.builder()
    .repositoryUrl("string")
    .args(Map.of("string", "string"))
    .builderVersion("BuilderV1")
    .cacheFrom("string")
    .context("string")
    .dockerfile("string")
    .imageName("string")
    .imageTag("string")
    .platform("string")
    .registryId("string")
    .target("string")
    .build());
Copy
image_resource = awsx.ecr.Image("imageResource",
    repository_url="string",
    args={
        "string": "string",
    },
    builder_version=awsx.ecr.BuilderVersion.BUILDER_V1,
    cache_from=["string"],
    context="string",
    dockerfile="string",
    image_name="string",
    image_tag="string",
    platform="string",
    registry_id="string",
    target="string")
Copy
const imageResource = new awsx.ecr.Image("imageResource", {
    repositoryUrl: "string",
    args: {
        string: "string",
    },
    builderVersion: awsx.ecr.BuilderVersion.BuilderV1,
    cacheFrom: ["string"],
    context: "string",
    dockerfile: "string",
    imageName: "string",
    imageTag: "string",
    platform: "string",
    registryId: "string",
    target: "string",
});
Copy
type: awsx:ecr:Image
properties:
    args:
        string: string
    builderVersion: BuilderV1
    cacheFrom:
        - string
    context: string
    dockerfile: string
    imageName: string
    imageTag: string
    platform: string
    registryId: string
    repositoryUrl: string
    target: string
Copy

Image Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Image resource accepts the following input properties:

RepositoryUrl This property is required. string
Url of the repository
Args Dictionary<string, string>
An optional map of named build-time argument variables to set during the Docker build. This flag allows you to pass built-time variables that can be accessed like environment variables inside the RUN instruction.
BuilderVersion Pulumi.Awsx.Ecr.BuilderVersion
The version of the Docker builder.
CacheFrom List<string>
Images to consider as cache sources
Context string
Path to a directory to use for the Docker build context, usually the directory in which the Dockerfile resides (although dockerfile may be used to choose a custom location independent of this choice). If not specified, the context defaults to the current working directory; if a relative path is used, it is relative to the current working directory that Pulumi is evaluating.
Dockerfile string
dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context.
ImageName string
Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used
ImageTag string
Custom image tag for the resulting docker image. If omitted a random string will be used
Platform string
The architecture of the platform you want to build this image for, e.g. linux/arm64.
RegistryId string
ID of the ECR registry in which to store the image. If not provided, this will be inferred from the repository URL)
Target string
The target of the dockerfile to build
RepositoryUrl This property is required. string
Url of the repository
Args map[string]string
An optional map of named build-time argument variables to set during the Docker build. This flag allows you to pass built-time variables that can be accessed like environment variables inside the RUN instruction.
BuilderVersion BuilderVersion
The version of the Docker builder.
CacheFrom []string
Images to consider as cache sources
Context string
Path to a directory to use for the Docker build context, usually the directory in which the Dockerfile resides (although dockerfile may be used to choose a custom location independent of this choice). If not specified, the context defaults to the current working directory; if a relative path is used, it is relative to the current working directory that Pulumi is evaluating.
Dockerfile string
dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context.
ImageName string
Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used
ImageTag string
Custom image tag for the resulting docker image. If omitted a random string will be used
Platform string
The architecture of the platform you want to build this image for, e.g. linux/arm64.
RegistryId string
ID of the ECR registry in which to store the image. If not provided, this will be inferred from the repository URL)
Target string
The target of the dockerfile to build
repositoryUrl This property is required. String
Url of the repository
args Map<String,String>
An optional map of named build-time argument variables to set during the Docker build. This flag allows you to pass built-time variables that can be accessed like environment variables inside the RUN instruction.
builderVersion BuilderVersion
The version of the Docker builder.
cacheFrom List<String>
Images to consider as cache sources
context String
Path to a directory to use for the Docker build context, usually the directory in which the Dockerfile resides (although dockerfile may be used to choose a custom location independent of this choice). If not specified, the context defaults to the current working directory; if a relative path is used, it is relative to the current working directory that Pulumi is evaluating.
dockerfile String
dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context.
imageName String
Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used
imageTag String
Custom image tag for the resulting docker image. If omitted a random string will be used
platform String
The architecture of the platform you want to build this image for, e.g. linux/arm64.
registryId String
ID of the ECR registry in which to store the image. If not provided, this will be inferred from the repository URL)
target String
The target of the dockerfile to build
repositoryUrl This property is required. string
Url of the repository
args {[key: string]: string}
An optional map of named build-time argument variables to set during the Docker build. This flag allows you to pass built-time variables that can be accessed like environment variables inside the RUN instruction.
builderVersion BuilderVersion
The version of the Docker builder.
cacheFrom string[]
Images to consider as cache sources
context string
Path to a directory to use for the Docker build context, usually the directory in which the Dockerfile resides (although dockerfile may be used to choose a custom location independent of this choice). If not specified, the context defaults to the current working directory; if a relative path is used, it is relative to the current working directory that Pulumi is evaluating.
dockerfile string
dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context.
imageName string
Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used
imageTag string
Custom image tag for the resulting docker image. If omitted a random string will be used
platform string
The architecture of the platform you want to build this image for, e.g. linux/arm64.
registryId string
ID of the ECR registry in which to store the image. If not provided, this will be inferred from the repository URL)
target string
The target of the dockerfile to build
repository_url This property is required. str
Url of the repository
args Mapping[str, str]
An optional map of named build-time argument variables to set during the Docker build. This flag allows you to pass built-time variables that can be accessed like environment variables inside the RUN instruction.
builder_version BuilderVersion
The version of the Docker builder.
cache_from Sequence[str]
Images to consider as cache sources
context str
Path to a directory to use for the Docker build context, usually the directory in which the Dockerfile resides (although dockerfile may be used to choose a custom location independent of this choice). If not specified, the context defaults to the current working directory; if a relative path is used, it is relative to the current working directory that Pulumi is evaluating.
dockerfile str
dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context.
image_name str
Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used
image_tag str
Custom image tag for the resulting docker image. If omitted a random string will be used
platform str
The architecture of the platform you want to build this image for, e.g. linux/arm64.
registry_id str
ID of the ECR registry in which to store the image. If not provided, this will be inferred from the repository URL)
target str
The target of the dockerfile to build
repositoryUrl This property is required. String
Url of the repository
args Map<String>
An optional map of named build-time argument variables to set during the Docker build. This flag allows you to pass built-time variables that can be accessed like environment variables inside the RUN instruction.
builderVersion "BuilderV1" | "BuilderBuildKit"
The version of the Docker builder.
cacheFrom List<String>
Images to consider as cache sources
context String
Path to a directory to use for the Docker build context, usually the directory in which the Dockerfile resides (although dockerfile may be used to choose a custom location independent of this choice). If not specified, the context defaults to the current working directory; if a relative path is used, it is relative to the current working directory that Pulumi is evaluating.
dockerfile String
dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context.
imageName String
Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used
imageTag String
Custom image tag for the resulting docker image. If omitted a random string will be used
platform String
The architecture of the platform you want to build this image for, e.g. linux/arm64.
registryId String
ID of the ECR registry in which to store the image. If not provided, this will be inferred from the repository URL)
target String
The target of the dockerfile to build

Outputs

All input properties are implicitly available as output properties. Additionally, the Image resource produces the following output properties:

ImageUri string
Unique identifier of the pushed image
ImageUri string
Unique identifier of the pushed image
imageUri String
Unique identifier of the pushed image
imageUri string
Unique identifier of the pushed image
image_uri str
Unique identifier of the pushed image
imageUri String
Unique identifier of the pushed image

Supporting Types

BuilderVersion
, BuilderVersionArgs

BuilderV1
BuilderV1The first generation builder for Docker Daemon.
BuilderBuildKit
BuilderBuildKitThe builder based on moby/buildkit project
BuilderVersionBuilderV1
BuilderV1The first generation builder for Docker Daemon.
BuilderVersionBuilderBuildKit
BuilderBuildKitThe builder based on moby/buildkit project
BuilderV1
BuilderV1The first generation builder for Docker Daemon.
BuilderBuildKit
BuilderBuildKitThe builder based on moby/buildkit project
BuilderV1
BuilderV1The first generation builder for Docker Daemon.
BuilderBuildKit
BuilderBuildKitThe builder based on moby/buildkit project
BUILDER_V1
BuilderV1The first generation builder for Docker Daemon.
BUILDER_BUILD_KIT
BuilderBuildKitThe builder based on moby/buildkit project
"BuilderV1"
BuilderV1The first generation builder for Docker Daemon.
"BuilderBuildKit"
BuilderBuildKitThe builder based on moby/buildkit project

Package Details

Repository
AWSx (Pulumi Crosswalk for AWS) pulumi/pulumi-awsx
License
Apache-2.0
AWSx (Pulumi Crosswalk for AWS) v2.21.1 published on Monday, Mar 10, 2025 by Pulumi