Can I use AWS ECR image directly in my Dockerfile?

In a typical dockerfile, there is usually this line From ubuntu:16.04 which enables pulling an image from docker repository.

Now I have built my own image repository:

enter image description here

The repositiory URI is:

As seen in the above screenshot, I pushed an image to the server.

I run the following to ensure I have login to the ecr

> `aws ecr get-login --region us-west-2`
Flag --email has been deprecated, will be removed in 1.14.
Login Succeeded

ECR login completes without error. Then I tried to build a new image:

> docker build -t rtf-converter . -f Dockerfile-rtf-converter 
Sending build context to Docker daemon 790.1 MB
Step 1/2 : FROM mycompany:latest
repository mycompany not found: does not exist or no pull access

Here is the content of the Dockerfile

FROM mycompany:latest
RUN apt-get install chef-zero

What is the right way to specify the repository properly in the FROM statement?

I am particularly confused by labels. What is a good convention of labeling?

The same pattern you use in docker push works:


It’s just a docker registry, so yes. Just make sure dockerd is authenticated with the ECR repo properly.

I see. I have tried asw ecr login but still fail. I will revise the question to address this problem. I hope you don’t mind I shift the goal poles