Skip to content

"COPY /blah/blub /path" does not work same way as docker #139

@sseide

Description

@sseide

The COPY command does not work for the following case - source files are not interpreted as relativ to the current workspace as stated in the original docker refence:

https://docs.docker.com/engine/reference/#copy

Multiple <src> resources may be specified but the paths of files and directories will be interpreted as relative to the source of the context of the build.

Example workspace directory:

Dockerfile
firstdir/seconddir/dir-a/file-a
firstdir/seconddir/dir-b/file-b

Dockerfile content:

FROM alpine:3.10
COPY /firstdir/seconddir /var
RUN ls -la /var && ls -la /var/firstdir
RUN ls -la /var/dir-a

The original docker builder copies the content of the firstdir/seconddir to the image, because all paths are relative to the context. imagebuilder failes with an error message saying stat seconddir: no such file or directory

Changing the COPY line to the following (removing first slash)

COPY firstdir/seconddir /var

Imagebuilder works as expected.

Metadata

Metadata

Assignees

Labels

lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions