Actual behavior
Using a multi-stage dockerfile where a nested path of one copied directory is copied between stages causes the build to fail.
# /kaniko/executor --dockerfile Dockerfile --context . --no-push
INFO[0000] Resolved base name alpine:3.11 to base
INFO[0000] Resolved base name alpine:3.11 to toplevel_copy
INFO[0000] Resolved base name alpine:3.11 to nested_copy
INFO[0000] Retrieving image manifest alpine:3.11
INFO[0000] Retrieving image alpine:3.11 from registry index.docker.io
INFO[0000] Retrieving image manifest alpine:3.11
INFO[0000] Returning cached image manifest
INFO[0000] Retrieving image manifest alpine:3.11
INFO[0000] Returning cached image manifest
INFO[0000] Built cross stage deps: map[0:[/top_level/ /top_level/nested]]
INFO[0000] Retrieving image manifest alpine:3.11
INFO[0000] Returning cached image manifest
INFO[0000] Executing 0 build triggers
INFO[0000] Unpacking rootfs as cmd RUN mkdir -p /top_level/nested requires it.
INFO[0000] RUN mkdir -p /top_level/nested
INFO[0000] Taking snapshot of full filesystem...
INFO[0000] cmd: /bin/sh
INFO[0000] args: [-c mkdir -p /top_level/nested]
INFO[0000] Running: [/bin/sh -c mkdir -p /top_level/nested]
INFO[0000] Taking snapshot of full filesystem...
INFO[0000] RUN echo my_dest /top_level/nested/target
INFO[0000] cmd: /bin/sh
INFO[0000] args: [-c echo my_dest /top_level/nested/target]
INFO[0000] Running: [/bin/sh -c echo my_dest /top_level/nested/target]
my_dest /top_level/nested/target
INFO[0000] Taking snapshot of full filesystem...
INFO[0000] No files were changed, appending empty layer to config. No layer added to image.
INFO[0000] RUN ln -s /top_level/nested/target /top_level/nested/my_link
INFO[0000] cmd: /bin/sh
INFO[0000] args: [-c ln -s /top_level/nested/target /top_level/nested/my_link]
INFO[0000] Running: [/bin/sh -c ln -s /top_level/nested/target /top_level/nested/my_link]
INFO[0000] Taking snapshot of full filesystem...
INFO[0000] Saving file top_level for later use
INFO[0000] Saving file top_level/nested for later use
error building image: could not save file: symlink /top_level/nested/target /kaniko/0/top_level/nested/my_link: file exists
Expected behavior
Both paths should be copy-able between stages
To Reproduce
Steps to reproduce the behavior:
Try to build the included Dockerfile
Additional Information
Dockerfile
RUN mkdir -p /top_level/nested
RUN echo my_dest /top_level/nested/target
RUN ln -s /top_level/nested/target /top_level/nested/my_link
FROM alpine:3.11 AS toplevel_copy
COPY --from=base /top_level/ /top_level/
FROM alpine:3.11 AS nested_copy
COPY --from=base /top_level/nested /top_level/nested
Actual behavior Using a multi-stage dockerfile where a nested path of one copied directory is copied between stages causes the build to fail.
Expected behavior Both paths should be copy-able between stages
To Reproduce Steps to reproduce the behavior:
Additional Information
Kaniko Image (fully qualified with digest)
Triage Notes for the Maintainers
--cache
flag