To copy files from the build context in a Docker image, use the COPY
instruction:
COPY localfile.txt containerfile.txt
If the filename contains spaces, use the alternate syntax:
COPY ["local file", "container file"]
The COPY
command supports wildcards. It can be used for example to copy all images to the images/
directory:
COPY *.jpg images/
Note: in this example, images/
may not exist. In this case, Docker will create it automatically.