Reputation: 3715
Does the COPY
command create an intermediate container to copy the files just like RUN
command? I did not find any reference to this in the docs.
Upvotes: 0
Views: 211
Reputation: 159171
It does not actually create a container.
In the classic builder, Builder.performCopy()
goes through the steps of assembling an augmented image: get the base image, create a new layer, actually copy files into the new layer, and then construct a new image. While there is a variable named runConfigWithCommentCmd
this just sets the per-layer description that's visible in docker history
.
Contrast this with dispatchRun()
which actually goes through the mechanics of creating and launching a container. Remember that a container fundamentally wraps a single command, and in the case of COPY
there's not an obvious command that could be run (nor, for that matter, is there guaranteed to be any runnable command in the container at all; consider a FROM scratch
image).
Upvotes: 2