Can Docker COPY commands be chained

Viewed 13781

Is is possible to chain the COPY commands together like what can be done with the RUN command?

Example of chaining run command:

RUN echo "root:user_2017" | chpasswd && \
    groupadd -g 1000 user && \
    useradd -u 1000 -m -s /bin/bash user && \
    passwd -d user

Would something like what is shown below prevent the introduction of multiple intermediate images if I had to perform many copies from the host to the image? I know what is shown below won't work because each line needs to be a separate command when the && is used to tie multiple lines together.

COPY ./folder1A/* /home/user/folder1B/ && \
     ./folder2A/* /home/user/folder2B/ && \
     ./folder3A/* /home/user/folder3B/ && \
     ./folder4A/* /home/user/folder4B/ && \
2 Answers
Related