Hi guys, I wonder if anyone could help, running in...
# general
w
Hi guys, I wonder if anyone could help, running into issue running this example in go : https://github.com/pulumi/pulumi-docker/blob/master/sdk/go/docker/image.go#L53 this is the error im getting :
Copy code
Diagnostics:
  docker:index:Image (DummyImage):
    error: unrecognized resource type (Check): docker:index/image:Image
here is the code related :
Copy code
demoImage, err := docker.NewImage(ctx, "DummyImage", &docker.ImageArgs{
			Build: &docker.DockerBuildArgs{
				Args: pulumi.StringMap{
					"platform": pulumi.String("linux/amd64"),
				},
				Context:    pulumi.String("../service"),
				Dockerfile: pulumi.String("../service/Dockerfile"),
			},
			ImageName: pulumi.String("sampleImageName"),
			SkipPush:  pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
pulumi docker
is at its latest release in my go.mod
v.4.5.0
pulumi
v3.95.0
Go version :
1.21.5
s
hey! I double checked this code with all of the same tool versions, using a generic python dockerfile and cannot repro what you are seeing. This error makes me think that somehow in your plugin cache, or possibly your $PATH you are still on Docker v3, which did not have that resource. Can you look at the result of
pulumi about
? also, there's a couple quirks in your code that didn't work straightaway: ā€¢ image names can't have all caps ā€¢ your
platform
should go into a top-level
Platform
field, not into Docker build args. Something like this should work:
Copy code
package main

import (
	"<http://github.com/pulumi/pulumi-docker/sdk/v4/go/docker|github.com/pulumi/pulumi-docker/sdk/v4/go/docker>"
	"<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		demoImage, err := docker.NewImage(ctx, "DummyImage", &docker.ImageArgs{
			Build: &docker.DockerBuildArgs{
				Platform:   pulumi.String("linux/amd64"),
				Context:    pulumi.String("../service"),
				Dockerfile: pulumi.String("../service/Dockerfile"),
			},
			ImageName: pulumi.String("sample-image-name"),
			SkipPush:  pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		ctx.Export("demo-image", demoImage.ImageName)
		return nil
	})
}
To check and remove any plugins, you can run
pulumi plugin
and follow the help text to list and remove.
w
hi @shy-arm-32391 thank you for that, the problem was my plugin docker wasnt up to date... after updating everything went well šŸ™‚ thank you for the help!
s
those things can be super sticky! glad you got it resolved šŸ™‚