Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Copy of symlinks fails when multistaging build #301

Open
remibooo opened this issue Jan 29, 2020 · 0 comments
Open

Copy of symlinks fails when multistaging build #301

remibooo opened this issue Jan 29, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@remibooo
Copy link

Describe the bug
Makisu fails to build when copying symlinks from a stage to another (multistaging build)

To Reproduce

I used the following simple Dockerfile:

FROM ubuntu AS builder
RUN mkdir -p /test/
RUN echo blabla >> /test/file
RUN ln -s /test/file /test/symlink
WORKDIR /home/

FROM ubuntu
COPY --from=builder /test/symlink /test/symlink

and ran it with the master version of makisu and the following command:
docker run -v "$PWD":/job remibooo03/makisu:v0.1.13 sh -c "/makisu/bin/makisu/makisu build --commit=explicit --modifyfs=true -t test_v0.1.13_minimal --dest /job/image_minimal.tar -f /job/Dockerfile_minimal /job 2> /job/log_minimal"

It gave the same error whether the flag commit was explicit or implicit.

Expected behavior
A successful built

Additional context
This is the error message I got (the final lines):

{"level":"info","ts":1580291383.9579847,"msg":"* Step 2/2 (commit) : COPY --from=builder /test/symlink /test/symlink  (bdc8ce21)"}
{"level":"info","ts":1580291383.9580278,"msg":"* Executed COPY --from=builder /test/symlink /test/symlink  (bdc8ce21)","duration":0.000017284}
{"level":"error","ts":1580291384.9725418,"msg":"failed to execute build plan: execute stage: build stage 1: build node: do commit: commit: failed to generate diff layer: write diffs: create layer by copy ops: stat src /makisu-storage/sandbox/sandbox055961992/stages/YnVpbGRlcg==/test/symlink: stat /makisu-storage/sandbox/sandbox055961992/stages/YnVpbGRlcg==/test/symlink: no such file or directory"}

This was solved by addind these two lines before the second stage (FROM ) of the dockerfile, in order to turn the symlinks into hardlinks, but obviously quite dirty...


WORKDIR /
RUN find -type l -exec bash -c 'ln -f "$(readlink -m "$0")" "$0"' {} \;
@yiranwang52 yiranwang52 added the bug Something isn't working label Feb 3, 2020
jockech pushed a commit that referenced this issue Feb 6, 2020
jockech pushed a commit that referenced this issue Feb 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants