Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Inconsistent behavior for symlink file COPY compared with docker build #915

@ZedYeung

Description

@ZedYeung

Actual behavior
A clear and concise description of what the bug is.
For docker build, copy symlink would copy the actual file.

Expected behavior
A clear and concise description of what you expected to happen.
For kaniko build, copy symlink would copy the symlink file.

To Reproduce
Steps to reproduce the behavior:

  1. ...FROM any image with /bin/sh(e.g. golang)
  2. ...FROM scratch
  3. ...COPY --from=0 /bin/sh /bin/sh

Additional Information

  • Dockerfile
FROM golang:1.13
FROM gcr.io/kaniko-project/executor
COPY --from=0 /bin/sh /bin/sh

Please provide either the Dockerfile you're trying to build or one that can reproduce this error.

  • Build Context
    Please provide or clearly describe any files needed to build the Dockerfile (ADD/COPY commands)
  • Kaniko Image (fully qualified with digest)
  • Personal thought
    Actually, /bin/sh is a symlink point to /bin/dash, but kaniko would only copy the symlink, which makes /bin/sh fail to work. In comparison, docker would copy the /bin/dash into /bin/sh.
    In kaniko, I found that the Dir symlink would be resolved here
    So far, the dir symlink would be resolved but the file symlink would be ignored. Any concern about that? Why they are treated in a different way?

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

Metadata

Metadata

Assignees

Labels

area/dockerfile-commandFor all bugs related to dockerfile file commandsin progresskind/bugSomething isn't workingpriority/p1Basic need feature compatibility with docker build. we should be working on this next.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions