<p>I'm trying to deploy a hello world container in kubernetes using Pulumi and GCP</p>
<p>Basically I just want this local helloworld container to be deployed in an existing k8s cluster on GCP made following <a href="https://www.pulumi.com/docs/tutorials/gcp/gcp-ts-gke-hello-world/" rel="nofollow noreferrer">this tutorial</a>.</p>
<p>Deploying local images is what is done in <a href="https://www.pulumi.com/docs/guides/crosswalk/kubernetes/apps/" rel="nofollow noreferrer">this other example</a>, however I need to add registry information which causes an error: <code>Property 'repositoryUrl' does not exist on type 'Promise&lt;GetRegistryRepositoryResult&gt;'.</code></p>
<pre><code>const registry = gcp.container.getRegistryRepository();
// Build a Docker image from a local Dockerfile context in the
// './mydockerimg' directory, and push it to the registry.
//const registry = gcp.container.getRegistryRepository();
const customImage = &quot;mydockerimg&quot;;
const appImage = new docker.Image(customImage, {
//    imageName: pulumi.interpolate`${registry.repositoryUrl}/${customImage}:v1.0.0`,
    imageName: &quot;mydockerimg&quot;,
    build: {
        context: `./${customImage}`,
    },
});
// Create a k8s provider.
// NOT NEEDED
// Create a Deployment of the built container.
const appLabels_helloworld = { app: customImage };
const appDeployment = new k8s.apps.v1.Deployment(&quot;app&quot;, {
    spec: {
        selector: { matchLabels: appLabels_helloworld },
        replicas: 1,
        template: {
            metadata: { labels: appLabels_helloworld },
            spec: {
                containers: [{
                    name: customImage,
                    image: appImage.imageName,
                    ports: [{name: &quot;http&quot;, containerPort: 80}],
                }],
            }
        },
    }
}, { provider: clusterProvider });
</code></pre>
<p>When I just use <code>imageName: &quot;mydockerimg&quot;,</code> rather than a registry, pulumi accepts the upgrade, but then I have a docker push error:</p>
<pre><code>error: Error: ' docker push mydockerimg:4aff09801cccc271a8182a3eb3bc46a25764fdbb5332230c6aa707e3b90c4d4e' failed with exit code 1
    The push refers to repository [docker.io/library/mydockerimg]
</code></pre>
<p>Any help?</p>
<hr />
<p><strong>EDIT:</strong> After applying Yaron Idan's suggestion below, <code>pulumi up</code> is working, but still not exporting the app, being unable to push.</p>
<pre><code>const gcrLocation = registry.then(registry =&gt; registry.repositoryUrl);
...
imageName: pulumi.interpolate`${gcrLocation}/${customImage}:v1.0.0`,
...
export const appDeploymentName = appDeployment.metadata.apply(m =&gt; m.name);
</code></pre>
<p>The error:</p>
<pre><code> Error: ' docker push gcr.io/XXX' failed with exit code 1
</code></pre>
<p>After some more investigation I have
error: name unknown: Buckets(projectID,artifacts.napoleongamesassignment.appspot.com)</p>
<p>after trying to <code>docker push gcr.io/myprojectID/myrstudio:latest</code>,</p>
<p>created <a href="https://stackoverflow.com/questions/69431077/docker-push-to-google-cloud-gcp-fails-with-name-unknown-buckets">another question</a></p>

<p>It looks like you're trying to extract the repository URL from the promise instead of it's resolution.<br />
Going by this <a href="https://www.pulumi.com/docs/reference/pkg/gcp/container/getregistryrepository/" rel="nofollow noreferrer">example</a> from the Pulumi docs, it looks like changing your code from</p>
<pre><code>imageName: pulumi.interpolate`${registry.repositoryUrl}/${customImage}:v1.0.0`,
</code></pre>
<p>to</p>
<pre><code>imageName: pulumi.interpolate`${registry.then(foo =&gt; foo.repositoryUrl)}/${customImage}:v1.0.0`,
</code></pre>
<p>Might give you the results you're looking for.</p>
