I am just learning to use Docker, so please bear with me.
I want to make a docker image that builds on top of another docker image I have already built. In my dockerfile, I refer to a specific version of the base image, but for the sake of maintainability, I only want to mention that version only once in the dockerfile. The dockerfile documentation seems to suggest to me that I can use the 'AS' keyword to map a symbolic name to the specific version tag. In the --from parameter to a next COPY instruction, I should then be able to use the symbolic name instead of the specific image:version tag.
This is my dockerfile:
FROM base:2.0 AS my_base
WORKDIR /child2
COPY --from=my_base /base /child2
COPY . /child2
CMD ["python", "-u", "child2.py"]
When I build using this dockerfile with
docker build -t child2 .
I get the following error:
Step 1/5 : FROM base:2.0 AS my_base
---> c5e2be45da55
Step 2/5 : WORKDIR /child2
---> Using cache
---> 1b5a4ad816c9
Step 3/5 : COPY --from=my_base /base /child2
invalid from flag value my_base: pull access denied for my_base, repository does not exist or may require 'docker login'
I did use 'docker login', but I got the exact same error again.
Do I make some mistake in the syntax of the dockerfile, or is my assumption on the use of the AS keyword simply incorrect?
I am using Docker version 18.09.2 on Windows 10.