The COPY command does not work for the following case - source files are not interpreted as relativ to the current workspace as stated in the original docker refence:
https://docs.docker.com/engine/reference/#copy
Multiple <src> resources may be specified but the paths of files and directories will be interpreted as relative to the source of the context of the build.
Example workspace directory:
Dockerfile
firstdir/seconddir/dir-a/file-a
firstdir/seconddir/dir-b/file-b
Dockerfile content:
FROM alpine:3.10
COPY /firstdir/seconddir /var
RUN ls -la /var && ls -la /var/firstdir
RUN ls -la /var/dir-a
The original docker builder copies the content of the firstdir/seconddir to the image, because all paths are relative to the context. imagebuilder failes with an error message saying stat seconddir: no such file or directory
Changing the COPY line to the following (removing first slash)
COPY firstdir/seconddir /var
Imagebuilder works as expected.
The COPY command does not work for the following case - source files are not interpreted as relativ to the current workspace as stated in the original docker refence:
https://docs.docker.com/engine/reference/#copy
Example workspace directory:
Dockerfile content:
The original docker builder copies the content of the firstdir/seconddir to the image, because all paths are relative to the context.
imagebuilderfailes with an error message sayingstat seconddir: no such file or directoryChanging the COPY line to the following (removing first slash)
Imagebuilder works as expected.