https://pulumi.com logo
#aws
Title
# aws
c

cuddly-australia-69919

10/26/2022, 11:03 PM
Hello all! I’m working with Pulumi in Python, which has been great so far. One area I’m stuck on is how to build and push a docker image to ECR with a custom tag. I’m able to build and push by creating an
awsx.ecr.Image
object but I haven’t been able to get a custom tag. Does anyone know how to achieve custom tags with ECR and pulumi? I’m happy to shift away from
awsx
as well if there is a different approach to this.
b

billowy-army-68599

10/26/2022, 11:06 PM
can you share the code you currently have?
c

cuddly-australia-69919

10/26/2022, 11:10 PM
Copy code
import pulumi_awsx as awsx

repo = awsx.ecr.Repository("repo_name")

image = awsx.ecr.Image(
    "my-image-name",
    repository_url=repo.url,
    path="path/to/docker/build/context",
    dockerfile="path/to/docker/file",
)
This is the code I have. The image and repo are imported into
__main__.py
so they get picked up and created by pulumi.
b

billowy-army-68599

10/26/2022, 11:20 PM
ah, yeah the tag is designed to change in this, if you want to set a custom tag, you’ll need to use
pulumi_docker
c

cuddly-australia-69919

10/26/2022, 11:23 PM
I’ll give that a shot. Do you have any examples of using
pulumi_docker
to set custom tags?
c

cuddly-australia-69919

10/26/2022, 11:30 PM
Great. I’ll try that out tomorrow. Thank you Lee!