1. Packages
  2. AWSx (Pulumi Crosswalk for AWS)
  3. API Docs
  4. ecr
  5. Image
Viewing docs for AWSx (Pulumi Crosswalk for AWS) v1.0.6 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
awsx logo
Viewing docs for AWSx (Pulumi Crosswalk for AWS) v1.0.6 (Older version)
published on Monday, Mar 9, 2026 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,
              cache_from: Optional[Sequence[str]] = None,
              dockerfile: Optional[str] = None,
              env: Optional[Mapping[str, str]] = None,
              extra_options: Optional[Sequence[str]] = None,
              path: 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 string
    The unique name of the resource.
    args ImageArgs
    The arguments to resource properties.
    opts ComponentResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args 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 string
    The unique name of the resource.
    args ImageArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ImageArgs
    The arguments to resource properties.
    opts ComponentResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args 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" },
        },
        CacheFrom = new[]
        {
            "string",
        },
        Dockerfile = "string",
        Env = 
        {
            { "string", "string" },
        },
        ExtraOptions = new[]
        {
            "string",
        },
        Path = "string",
        Target = "string",
    });
    
    example, err := ecr.NewImage(ctx, "imageResource", &ecr.ImageArgs{
    	RepositoryUrl: pulumi.String("string"),
    	Args: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	CacheFrom: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Dockerfile: pulumi.String("string"),
    	Env: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	ExtraOptions: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Path:   pulumi.String("string"),
    	Target: pulumi.String("string"),
    })
    
    var imageResource = new Image("imageResource", ImageArgs.builder()
        .repositoryUrl("string")
        .args(Map.of("string", "string"))
        .cacheFrom("string")
        .dockerfile("string")
        .env(Map.of("string", "string"))
        .extraOptions("string")
        .path("string")
        .target("string")
        .build());
    
    image_resource = awsx.ecr.Image("imageResource",
        repository_url="string",
        args={
            "string": "string",
        },
        cache_from=["string"],
        dockerfile="string",
        env={
            "string": "string",
        },
        extra_options=["string"],
        path="string",
        target="string")
    
    const imageResource = new awsx.ecr.Image("imageResource", {
        repositoryUrl: "string",
        args: {
            string: "string",
        },
        cacheFrom: ["string"],
        dockerfile: "string",
        env: {
            string: "string",
        },
        extraOptions: ["string"],
        path: "string",
        target: "string",
    });
    
    type: awsx:ecr:Image
    properties:
        args:
            string: string
        cacheFrom:
            - string
        dockerfile: string
        env:
            string: string
        extraOptions:
            - string
        path: string
        repositoryUrl: string
        target: string
    

    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 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.
    CacheFrom List<string>
    Images to consider as cache sources
    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.
    Env Dictionary<string, string>
    Environment variables to set on the invocation of docker build, for example to support DOCKER_BUILDKIT=1 docker build.
    ExtraOptions List<string>
    An optional catch-all list of arguments to provide extra CLI options to the docker build command. For example ['--network', 'host'].
    Path 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.
    Target string
    The target of the dockerfile to build
    RepositoryUrl 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.
    CacheFrom []string
    Images to consider as cache sources
    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.
    Env map[string]string
    Environment variables to set on the invocation of docker build, for example to support DOCKER_BUILDKIT=1 docker build.
    ExtraOptions []string
    An optional catch-all list of arguments to provide extra CLI options to the docker build command. For example ['--network', 'host'].
    Path 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.
    Target string
    The target of the dockerfile to build
    repositoryUrl 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.
    cacheFrom List<String>
    Images to consider as cache sources
    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.
    env Map<String,String>
    Environment variables to set on the invocation of docker build, for example to support DOCKER_BUILDKIT=1 docker build.
    extraOptions List<String>
    An optional catch-all list of arguments to provide extra CLI options to the docker build command. For example ['--network', 'host'].
    path 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.
    target String
    The target of the dockerfile to build
    repositoryUrl 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.
    cacheFrom string[]
    Images to consider as cache sources
    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.
    env {[key: string]: string}
    Environment variables to set on the invocation of docker build, for example to support DOCKER_BUILDKIT=1 docker build.
    extraOptions string[]
    An optional catch-all list of arguments to provide extra CLI options to the docker build command. For example ['--network', 'host'].
    path 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.
    target string
    The target of the dockerfile to build
    repository_url 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.
    cache_from Sequence[str]
    Images to consider as cache sources
    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.
    env Mapping[str, str]
    Environment variables to set on the invocation of docker build, for example to support DOCKER_BUILDKIT=1 docker build.
    extra_options Sequence[str]
    An optional catch-all list of arguments to provide extra CLI options to the docker build command. For example ['--network', 'host'].
    path 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.
    target str
    The target of the dockerfile to build
    repositoryUrl 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.
    cacheFrom List<String>
    Images to consider as cache sources
    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.
    env Map<String>
    Environment variables to set on the invocation of docker build, for example to support DOCKER_BUILDKIT=1 docker build.
    extraOptions List<String>
    An optional catch-all list of arguments to provide extra CLI options to the docker build command. For example ['--network', 'host'].
    path 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.
    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

    Package Details

    Repository
    AWSx (Pulumi Crosswalk for AWS) pulumi/pulumi-awsx
    License
    Apache-2.0
    awsx logo
    Viewing docs for AWSx (Pulumi Crosswalk for AWS) v1.0.6 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.