gcp.artifactregistry.getDockerImage
Explore with Pulumi AI
This data source fetches information from a provided Artifact Registry repository, including the fully qualified name and URI for an image, based on a the latest version of image name and optional digest or tag.
Note Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/cloud-platformorhttps://www.googleapis.com/auth/cloud-platform.read-only.
Example Usage
Coming soon!
Coming soon!
Coming soon!
Coming soon!
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.artifactregistry.Repository;
import com.pulumi.gcp.artifactregistry.RepositoryArgs;
import com.pulumi.gcp.artifactregistry.ArtifactregistryFunctions;
import com.pulumi.gcp.artifactregistry.inputs.GetDockerImageArgs;
import com.pulumi.gcp.cloudrunv2.Service;
import com.pulumi.gcp.cloudrunv2.ServiceArgs;
import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        var myRepo = new Repository("myRepo", RepositoryArgs.builder()
            .location("us-west1")
            .repositoryId("my-repository")
            .format("DOCKER")
            .build());
        final var myImage = ArtifactregistryFunctions.getDockerImage(GetDockerImageArgs.builder()
            .repository(myRepo.id())
            .image("my-image")
            .tag("my-tag")
            .build());
        var default_ = new Service("default", ServiceArgs.builder()
            .template(ServiceTemplateArgs.builder()
                .containers(ServiceTemplateContainerArgs.builder()
                    .image(myImage.applyValue(getDockerImageResult -> getDockerImageResult).applyValue(myImage -> myImage.applyValue(getDockerImageResult -> getDockerImageResult.selfLink())))
                    .build())
                .build())
            .build());
    }
}
resources:
  myRepo:
    type: gcp:artifactregistry:Repository
    name: my_repo
    properties:
      location: us-west1
      repositoryId: my-repository
      format: DOCKER
  default:
    type: gcp:cloudrunv2:Service
    properties:
      template:
        containers:
          - image: ${myImage.selfLink}
variables:
  myImage:
    fn::invoke:
      Function: gcp:artifactregistry:getDockerImage
      Arguments:
        repository: ${myRepo.id}
        image: my-image
        tag: my-tag
Using getDockerImage
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getDockerImage(args: GetDockerImageArgs, opts?: InvokeOptions): Promise<GetDockerImageResult>
function getDockerImageOutput(args: GetDockerImageOutputArgs, opts?: InvokeOptions): Output<GetDockerImageResult>def get_docker_image(image_name: Optional[str] = None,
                     location: Optional[str] = None,
                     project: Optional[str] = None,
                     repository_id: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetDockerImageResult
def get_docker_image_output(image_name: Optional[pulumi.Input[str]] = None,
                     location: Optional[pulumi.Input[str]] = None,
                     project: Optional[pulumi.Input[str]] = None,
                     repository_id: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetDockerImageResult]func GetDockerImage(ctx *Context, args *GetDockerImageArgs, opts ...InvokeOption) (*GetDockerImageResult, error)
func GetDockerImageOutput(ctx *Context, args *GetDockerImageOutputArgs, opts ...InvokeOption) GetDockerImageResultOutput> Note: This function is named GetDockerImage in the Go SDK.
public static class GetDockerImage 
{
    public static Task<GetDockerImageResult> InvokeAsync(GetDockerImageArgs args, InvokeOptions? opts = null)
    public static Output<GetDockerImageResult> Invoke(GetDockerImageInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetDockerImageResult> getDockerImage(GetDockerImageArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: gcp:artifactregistry/getDockerImage:getDockerImage
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Image
Name string - The image name to fetch. If no digest or tag is provided, then the latest modified image will be used.
 - Location string
 - The location of the artifact registry.
 - Repository
Id string - The last part of the repository name. to fetch from.
 - Project string
 - The project ID in which the resource belongs. If it is not provided, the provider project is used.
 
- Image
Name string - The image name to fetch. If no digest or tag is provided, then the latest modified image will be used.
 - Location string
 - The location of the artifact registry.
 - Repository
Id string - The last part of the repository name. to fetch from.
 - Project string
 - The project ID in which the resource belongs. If it is not provided, the provider project is used.
 
- image
Name String - The image name to fetch. If no digest or tag is provided, then the latest modified image will be used.
 - location String
 - The location of the artifact registry.
 - repository
Id String - The last part of the repository name. to fetch from.
 - project String
 - The project ID in which the resource belongs. If it is not provided, the provider project is used.
 
- image
Name string - The image name to fetch. If no digest or tag is provided, then the latest modified image will be used.
 - location string
 - The location of the artifact registry.
 - repository
Id string - The last part of the repository name. to fetch from.
 - project string
 - The project ID in which the resource belongs. If it is not provided, the provider project is used.
 
- image_
name str - The image name to fetch. If no digest or tag is provided, then the latest modified image will be used.
 - location str
 - The location of the artifact registry.
 - repository_
id str - The last part of the repository name. to fetch from.
 - project str
 - The project ID in which the resource belongs. If it is not provided, the provider project is used.
 
- image
Name String - The image name to fetch. If no digest or tag is provided, then the latest modified image will be used.
 - location String
 - The location of the artifact registry.
 - repository
Id String - The last part of the repository name. to fetch from.
 - project String
 - The project ID in which the resource belongs. If it is not provided, the provider project is used.
 
getDockerImage Result
The following output properties are available:
- Build
Time string - The time, as a RFC 3339 string, this image was built.
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Image
Name string - Image
Size stringBytes  - Calculated size of the image in bytes.
 - Location string
 - Media
Type string - Media type of this image, e.g. 
application/vnd.docker.distribution.manifest.v2+json. - Name string
 - The fully qualified name of the fetched image. This name has the form: 
projects/{{project}}/locations/{{location}}/repository/{{repository_id}}/dockerImages/{{docker_image}}. For example,projects/test-project/locations/us-west4/repositories/test-repo/dockerImages/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf - Repository
Id string - Self
Link string - The URI to access the image. For example,
us-west4-docker.pkg.dev/test-project/test-repo/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf - List<string>
 - A list of all tags associated with the image.
 - Update
Time string - The time, as a RFC 3339 string, this image was updated.
 - Upload
Time string - The time, as a RFC 3339 string, the image was uploaded. For example, 
2014-10-02T15:01:23.045123456Z. - Project string
 
- Build
Time string - The time, as a RFC 3339 string, this image was built.
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Image
Name string - Image
Size stringBytes  - Calculated size of the image in bytes.
 - Location string
 - Media
Type string - Media type of this image, e.g. 
application/vnd.docker.distribution.manifest.v2+json. - Name string
 - The fully qualified name of the fetched image. This name has the form: 
projects/{{project}}/locations/{{location}}/repository/{{repository_id}}/dockerImages/{{docker_image}}. For example,projects/test-project/locations/us-west4/repositories/test-repo/dockerImages/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf - Repository
Id string - Self
Link string - The URI to access the image. For example,
us-west4-docker.pkg.dev/test-project/test-repo/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf - []string
 - A list of all tags associated with the image.
 - Update
Time string - The time, as a RFC 3339 string, this image was updated.
 - Upload
Time string - The time, as a RFC 3339 string, the image was uploaded. For example, 
2014-10-02T15:01:23.045123456Z. - Project string
 
- build
Time String - The time, as a RFC 3339 string, this image was built.
 - id String
 - The provider-assigned unique ID for this managed resource.
 - image
Name String - image
Size StringBytes  - Calculated size of the image in bytes.
 - location String
 - media
Type String - Media type of this image, e.g. 
application/vnd.docker.distribution.manifest.v2+json. - name String
 - The fully qualified name of the fetched image. This name has the form: 
projects/{{project}}/locations/{{location}}/repository/{{repository_id}}/dockerImages/{{docker_image}}. For example,projects/test-project/locations/us-west4/repositories/test-repo/dockerImages/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf - repository
Id String - self
Link String - The URI to access the image. For example,
us-west4-docker.pkg.dev/test-project/test-repo/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf - List<String>
 - A list of all tags associated with the image.
 - update
Time String - The time, as a RFC 3339 string, this image was updated.
 - upload
Time String - The time, as a RFC 3339 string, the image was uploaded. For example, 
2014-10-02T15:01:23.045123456Z. - project String
 
- build
Time string - The time, as a RFC 3339 string, this image was built.
 - id string
 - The provider-assigned unique ID for this managed resource.
 - image
Name string - image
Size stringBytes  - Calculated size of the image in bytes.
 - location string
 - media
Type string - Media type of this image, e.g. 
application/vnd.docker.distribution.manifest.v2+json. - name string
 - The fully qualified name of the fetched image. This name has the form: 
projects/{{project}}/locations/{{location}}/repository/{{repository_id}}/dockerImages/{{docker_image}}. For example,projects/test-project/locations/us-west4/repositories/test-repo/dockerImages/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf - repository
Id string - self
Link string - The URI to access the image. For example,
us-west4-docker.pkg.dev/test-project/test-repo/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf - string[]
 - A list of all tags associated with the image.
 - update
Time string - The time, as a RFC 3339 string, this image was updated.
 - upload
Time string - The time, as a RFC 3339 string, the image was uploaded. For example, 
2014-10-02T15:01:23.045123456Z. - project string
 
- build_
time str - The time, as a RFC 3339 string, this image was built.
 - id str
 - The provider-assigned unique ID for this managed resource.
 - image_
name str - image_
size_ strbytes  - Calculated size of the image in bytes.
 - location str
 - media_
type str - Media type of this image, e.g. 
application/vnd.docker.distribution.manifest.v2+json. - name str
 - The fully qualified name of the fetched image. This name has the form: 
projects/{{project}}/locations/{{location}}/repository/{{repository_id}}/dockerImages/{{docker_image}}. For example,projects/test-project/locations/us-west4/repositories/test-repo/dockerImages/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf - repository_
id str - self_
link str - The URI to access the image. For example,
us-west4-docker.pkg.dev/test-project/test-repo/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf - Sequence[str]
 - A list of all tags associated with the image.
 - update_
time str - The time, as a RFC 3339 string, this image was updated.
 - upload_
time str - The time, as a RFC 3339 string, the image was uploaded. For example, 
2014-10-02T15:01:23.045123456Z. - project str
 
- build
Time String - The time, as a RFC 3339 string, this image was built.
 - id String
 - The provider-assigned unique ID for this managed resource.
 - image
Name String - image
Size StringBytes  - Calculated size of the image in bytes.
 - location String
 - media
Type String - Media type of this image, e.g. 
application/vnd.docker.distribution.manifest.v2+json. - name String
 - The fully qualified name of the fetched image. This name has the form: 
projects/{{project}}/locations/{{location}}/repository/{{repository_id}}/dockerImages/{{docker_image}}. For example,projects/test-project/locations/us-west4/repositories/test-repo/dockerImages/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf - repository
Id String - self
Link String - The URI to access the image. For example,
us-west4-docker.pkg.dev/test-project/test-repo/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf - List<String>
 - A list of all tags associated with the image.
 - update
Time String - The time, as a RFC 3339 string, this image was updated.
 - upload
Time String - The time, as a RFC 3339 string, the image was uploaded. For example, 
2014-10-02T15:01:23.045123456Z. - project String
 
Package Details
- Repository
 - Google Cloud (GCP) Classic pulumi/pulumi-gcp
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
google-betaTerraform Provider.