Pulling from a local docker image instead

Viewed 17137

I have an app with a Dockerfile content that looks like

Dockerfile

FROM SOME_NUMBERS.dkr.ecr.us-east-1.amazonaws.com/app_name:SOME_HEX_VALUE

COPY docker/app/bin/startup.sh /usr/bin/

CMD ["/usr/bin/startup.sh"]

I don't want to pull the image from amazon anymore instead I'd like to "pull" from the already-existing local image pulled the after the first docker-compose up --build command was ran.

When I do docker images I get

SOME_NUMBERS.dkr.ecr.us-east-1.amazonaws.com/app_name SOME_HEX_VALUE SOMESHORT_HEX 2 days ago 1.54 GB which means the image is local already. I understand this

if the host has the image you want docker-compose to use on it it will use that image but if the host doesn't have it, it will go to docker hub or whatever you have setup in your config for registries

So I changed the Dockerfile content to this:

FROM IMAGE_ID:SOME_HEX_VALUE where IMAGE_ID is the image id of the repository I want when I do docker images but then I get Service 'app' failed to build: repository SOMESHORT_HEX not found: does not exist or no pull access and I'd like to know how to tell Docker to use the local image instead of trying to pull from the amazon url. Any ideas?

2 Answers
Related