Maybe I'll be late, but here are my 10 cents (complementary answer from ashishjain):
Basically, an image layer or layer is a change in an image or an intermediate image . Each command you specify ( FROM , RUN , COPY , etc.) in your Docker file changes the previous image, creating a new layer. You can think of it as permutations when you use git: you add a file change, then one more and then another ...
Consider the following Docker file:
FROM rails:onbuild ENV RAILS_ENV production ENTRYPOINT ["bundle", "exec", "puma"]
First, we select the initial image: rails:onbuild , which, in turn, has many layers . Add another layer on top of our start image by setting the environment variable RAILS_ENV with the ENV command. Then we say that docker launches bundle exec puma (which loads the rails server). This other layer.
The concept of layers comes in handy when creating images. Since layers are intermediate images, if you make changes to your Docker file, the docker will only create the layer that was changed and those that were after that. This is called layer caching.
You can read about it here .
David Castillo Nov 20 '15 at 22:06 2015-11-20 22:06
source share