Hello! I was hoping someone could help me come up ...
# aws
b
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
I ended using a shell-script, not the most elegant, but works:
Copy code
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
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
@freezing-van-87649 thank you 🙌 this accomplishes exactly what I need
🎉 1
f
awesome, glad to hear it