Hey everyone, newer to pulumi and learning by depl...
# getting-started
m
Hey everyone, newer to pulumi and learning by deploying a web app to Digtalocean. I am using python as my language for pulumi and having issues with using docker.RemoteImage for a private image hosted on ghcr. Here is what I have tried to far • reading the docs • trying to use
docker pull
works just fine as I have already l ran
docker login
with my github token. • I have a separate stack that does the building of the image and pushing to ghcr and have no issues doing this with docker-build.image • works just fine if I make the image public on ghcr I followed this helpful tutorial on Abstraction and Encapsulation to build my own docker image component which does different things based on the stack it's ran in. This is code I am using from my prod stack where I just want to use a remote image ( vs building and deploying to ghcr )
Copy code
def use_remote_image(self) -> docker.RemoteImage:
        registry_image = docker.get_registry_image(name=self.image_tag)
        return docker.RemoteImage(
            self.docker_build_image_config.get("resource_name"),
            name=registry_image.name,
            keep_locally=True,
            pull_triggers=[registry_image.sha256_digest],
        )
The error I get is
Got bad response from registry: 401 Unauthorized
Any idea on how I can pass in my credentials to RemoteImage? Couldn't figure out which arg to use.
Another thing I have tried was seeing if I could use docker-build.image instead of remote image and make
fetch = True
but for some reason it was not pulling the image it was just building it and exporting locally
l
You can pass a Docker provider to RemoteImage if you want. The
registryAuth
property contains the creds. I presume the default Docker provider allows these to be assigned, but I don't know for sure. Out of curiosity: could you get away with a well-known image name and tag? Since most consumers of Docker images only need that information, you might not need a RemoteImage at all.