Docker Community Forums

Share and learn in the Docker community.

Does each COPY add a layer?


(Camerongo) #1

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


(Joe) #2

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

-Joe


(Camerongo) #3

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


(Sam Saffron) #4

You can run docker squash on this stuff if you want

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