kaniko
kaniko copied to clipboard
ADD directive: Cannot copy file to a destination that has symlink
Actual behavior kaniko failed to copy the downloaded file to the destination, and printed an error,
INFO[0022] Adding remote URL https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.3.1/grpc_health_probe-linux-amd64 to /bin/grpc_health_probe
INFO[0022] destination cannot be a symlink /bin
error building image: error building stage: failed to execute command: downloading remote source file: creating parent dir: destination cannot be a symlink
Expected behavior The download file should be placed under the /bin directory.
To Reproduce Steps to reproduce the behavior:
- Place the below Dockerfile in a directory
- Run the following command
docker run \
-v $PWD:/workspace \
gcr.io/kaniko-project/executor@sha256:fcccd2ab9f3892e33fc7f2e950c8e4fc665e7a4c66f6a9d70b300d7a2103592f \
--dockerfile /workspace/Dockerfile \
--context dir://. \
--no-push
Additional Information
- Dockerfile
FROM amazoncorretto:11.0.4 as BUILD
ARG GRPC_HEALTH_PROBE_VERSION=v0.3.1
RUN curl -O /bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64
ADD https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 /bin/grpc_health_probe
- Build Context - None
- Kaniko Image (
gcr.io/kaniko-project/executor@sha256:fcccd2ab9f3892e33fc7f2e950c8e4fc665e7a4c66f6a9d70b300d7a2103592f)
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 |
|
To add to this - it's tricky because the symlinked destination is actually coming from a FROM layer that I don't have direct control over. I need to copy a config file in there, but can't, because of this bug / feature gap.
Is anyone aware of a workaround?