Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD directive: Cannot copy file to a destination that has symlink #1763

Open
kennethzfeng opened this issue Oct 13, 2021 · 1 comment
Open
Labels
area/dockerfile-command For all bugs related to dockerfile file commands area/symlinks categorized cmd/add differs-from-docker issue/destination-cannot-be-a-symlink kind/bug Something isn't working priority/p1 Basic need feature compatibility with docker build. we should be working on this next. works-with-docker

Comments

@kennethzfeng
Copy link

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:

  1. Place the below Dockerfile in a directory
  2. 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
@aaron-prindle aaron-prindle added kind/bug Something isn't working priority/p1 Basic need feature compatibility with docker build. we should be working on this next. differs-from-docker works-with-docker cmd/add area/symlinks area/dockerfile-command For all bugs related to dockerfile file commands labels Jun 15, 2023
@tdalbo92
Copy link

tdalbo92 commented Apr 1, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dockerfile-command For all bugs related to dockerfile file commands area/symlinks categorized cmd/add differs-from-docker issue/destination-cannot-be-a-symlink kind/bug Something isn't working priority/p1 Basic need feature compatibility with docker build. we should be working on this next. works-with-docker
Projects
None yet
Development

No branches or pull requests

3 participants