Skip to content

2 successive ADDs will fail if they create the same subdirectory #896

@shykes

Description

@shykes
$ mkdir -p A/dev/foo
$ mkdir -p B/dev/bar
$ cat > Dockerfile <<EOF
from shykes/gordon
ADD A /
ADD B /
EOF
$ docker build -t failtest .
[...]

The contents of the image should be:

/dev/foo
/dev/bar

Instead they will be:

/dev/foo
/dev/dev/bar

This is because of the behavior of cp -ar which changes when the destination directory already exists.
It should be replaced by the more reliable method of tar/untar. This method is also used in the rest
of the codebase.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions