kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

COPY fails when multiple files are copied to path specified in ENV

Open softmetz opened this issue 2 years ago • 1 comments

Actual behavior When I RUN

ENV TARGET_PATH=/target/path/

COPY /source/* $TARGET_PATH

Kaniko fails with

error building image: error building stage: failed to get files used from context: when specifying multiple sources in a COPY command, destination must be a directory and end in '/'

Expected behavior

COPY copies the files to the target directory

To Reproduce Steps to reproduce the behavior:

See actual behaviour

Additional Information

  • Dockerfile
ENV TARGET_PATH=/target/path/

RUN mkdir -p $TARGET_PATH

COPY /source/* $TARGET_PATH
  • Build Context
.
└── source
    ├── bar
    └── foo
  • Kaniko Image (fully qualified with digest): gcr.io/kaniko-project/executor@sha256:899886a2db1c127ff1565d5c7b1e574af1810bbdad048e9850e4f40b5848d79c

Triage Notes for the Maintainers

Description Yes/No
Please check if this a new feature you are proposing
  • - [ ]
Please check if the build works in docker but not in kaniko
  • - [ ]
Please check if this error is seen when you use --cache flag
  • - [ ]
Please check if your dockerfile is a multistage dockerfile
  • - [ ]

softmetz avatar Jan 12 '24 11:01 softmetz

Just got the same error on the same COPY issue

COPY /source/* target/

yossicohn avatar Jan 14 '24 17:01 yossicohn