1

I've encountered a Multi-stage Build example, where the first stage builds a ngnix server, and the second stage creates a ngnix service from that image.

The second stage looks like this:

...
# second stage
FROM scratch
COPY --from=build /etc/passwd /etc/group /etc/
COPY --from=build /usr/local/nginx /usr/local/nginx
COPY index.html /usr/local/nginx/html
...

This is a working example.

Now, notice the first COPY command. It received three parameters(!)

What is the meaning of 3 parameters in the COPY command? do you have a reference to documentation regarding this input?

Notice that the second COPY command uses 2 parameters, which I assumed are src and dest folders.

1

As per this docker documentation the copy instruction may have multiple sources but only one destination.
Your first copy is coping two file /etc/passwd and /etc/group to /etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.