27

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: 1234567890.dkr.ecr.us-west-2.amazonaws.com/mycompany

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?

chicks
  • 3,639
  • 10
  • 26
  • 36
Anthony Kong
  • 2,976
  • 10
  • 53
  • 91
  • It's just a docker registry, so yes. Just make sure dockerd is authenticated with the ECR repo properly. – EEAA Jun 01 '17 at 23:11
  • 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 – Anthony Kong Jun 01 '17 at 23:15
  • using the example above i wonder how/where to specify AWS credential? FROM 1234567890.dkr.ecr.us-west-2.amazonaws.com/mycompany:latest – alvin Apr 06 '22 at 15:33

1 Answers1

34

The same pattern you use in docker push works:

FROM 1234567890.dkr.ecr.us-west-2.amazonaws.com/mycompany:latest
Jason Martin
  • 4,865
  • 15
  • 24
  • For public images, see https://stackoverflow.com/questions/45634619/how-to-make-ecs-repository-public – radtek Jan 30 '19 at 19:57