https://pulumi.com logo
Title
b

bland-byte-34481

08/25/2021, 11:14 PM
Hello! I was hoping someone could help me come up with a solution for moving Docker images around (in ECR)... i'd like to do the following: 1. Pull a docker image from a source (we'll call this repository A) 2. Push the image from repository A to repository B I've been trying to do this with the following steps without success: 1. Fetch repository A metadata with aws.ecr.getRepository 2. Fetch repository A creds with aws.ecr.getCredentials 3. Create a new docker.RemoteImage (using the image I want and a custom provider with the credentials from (2)) 4. I then create a new repository (repository B) using new aws.ecr.Repository 5. I then get the credentials for that repository and create a new docker.RegistryImage and pass the creds from (4) in authConfigs I run into an issue at (5) because I have no Dockerfile to pass to the build context. I try to use the output from the docker.RemoteImage which is supposed to pull the remote image to my local filesystem but can't locate that file. Any guidance is appreciated, thanks!
I'm hoping there is something I can do with the RemoteImage class, but a lot of the args aren't documented: https://www.pulumi.com/docs/reference/pkg/docker/remoteimage/#dockerfile_nodejs
So not quite sure what to do
b

broad-gold-44713

08/26/2021, 3:56 AM
I ended using a shell-script, not the most elegant, but works:
aws ecr --profile <profile> get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${REPO_B}
docker tag ${REPO_A}/<image>:<tag> ${REPO_B}/<image>:<tag>
docker push ${REPO_A}/<image>:<tag>
f

freezing-van-87649

08/26/2021, 11:50 AM
My suggestion that doesn’t answer your question was going to be remind you that image replication exists: https://docs.aws.amazon.com/AmazonECR/latest/userguide/replication.html
b

bland-byte-34481

08/26/2021, 6:16 PM
@freezing-van-87649 thank you 🙌 this accomplishes exactly what I need
🎉 1
f

freezing-van-87649

08/26/2021, 8:08 PM
awesome, glad to hear it