0

So I am using Amazon Elastic Container Registry (ECR) to store our containers. I have a container that is built using a Microsoft base image:

mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2016

What I am finding is that when I then push my container image to Amazon ECR, and then later I pull this image - it is STILL downloading the base layer from mcr.microsoft.com!

I am using Docker for Windows Server (not Docker for Linux).

I don't want this because mcr.microsoft.com is super slow and unreliable. Plus Microsoft keeps breaking the links by changing the names of the servers.

How do I get docker to NOT store an "external link" for the first layer to mcr.microsoft.com and instead store everything on Amazon ECR?

A X
  • 469
  • 4
  • 10
  • 31

1 Answers1

1

If you push an image to ECR you are no longer relying on the "first layer" of your dockerfile for the image you built. If you have a Dockerfile that has a FROM that points to mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2016 and you build an image off of this Dockerfile, you can push to ECR and you are no longer dependent on the mcr.

I am wondering if you are somehow still pulling from mcr in your docker pull syntax?

Your pull should have have a syntax along the lines of docker pull aws_account_id.dkr.ecr.us-west-2.amazonaws.com/my_image:my_tag and such a command won't depend on mcr

mreferre
  • 456
  • 2
  • 6
  • Hmm this is what I thought but somehow it is still pulling the first layer from mcr and not amazon ecr. I am using the FROM command as you say above - is it possible that is somehow the reason? Is there a parameter in FROM to prevent this? – A X Oct 16 '21 at 21:08
  • Also please note this is Windows Server 2016 and not Linux – A X Oct 16 '21 at 21:28
  • The only way to pull from `mcr` would be at `docker build` time. Once you have built the container and pushed to ECR you are basically only pulling from ECR. How/where do you see it's still pulling from `mcr` when you pull from `ECR`? What does it make you say " it is still pulling the first layer from mcr and not amazon ecr"? – mreferre Oct 17 '21 at 14:07