HiveBrain v1.2.0
Get Started
← Back to all entries
patterndockerMinor

Dockerfile COPY command with three input parameters

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
threewithinputdockerfilecommandparameterscopy

Problem

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.

Solution

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.

Context

StackExchange DevOps Q#4888, answer score: 2

Revisions (0)

No revisions yet.