get Docker Image
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-platform
orhttps://www.googleapis.com/auth/cloud-platform.read-only
.
Example Usage
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()
.location(myRepo.location())
.repositoryId(myRepo.repositoryId())
.image("my-image: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:
location: ${myRepo.location}
repositoryId: ${myRepo.repositoryId}
image: my-image:my-tag
Return
A collection of values returned by getDockerImage.
Parameters
A collection of arguments for invoking getDockerImage.
Return
A collection of values returned by getDockerImage.
Parameters
The image name to fetch. If no digest or tag is provided, then the latest modified image will be used.
The location of the artifact registry.
The project ID in which the resource belongs. If it is not provided, the provider project is used.
The last part of the repository name to fetch from.
See also
Return
A collection of values returned by getDockerImage.
Parameters
Builder for com.pulumi.gcp.artifactregistry.kotlin.inputs.GetDockerImagePlainArgs.