Does each COPY add a layer?

I’m a little unclear on how the different layers work in detail. Can anyone tell me if each individual COPY command adds additional layers or otherwise negatively impacts the performance or efficiency of the images? I’m trying to determine of COPY app /usr/app/
COPY site /var/www/site/
COPY config /etc/app/

Is in any way less optimal in image construction that just COPY . /blah/app

Yes, COPY command does add a new layer to the image every time it is invoked.


1 Like

OK - thanks for the clarification. Is there any way to nest these together - similar to how you can nest multiple RUN commands?

You can run docker squash on this stuff if you want

Still feel this really should be part of Docker :wink: