mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-07 06:22:03 +00:00
Error out if file in container at volume path
Fixes #4393 Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
@@ -4784,3 +4784,20 @@ RUN echo " \
|
||||
|
||||
logDone("build - test spaces with quotes")
|
||||
}
|
||||
|
||||
// #4393
|
||||
func TestBuildVolumeFileExistsinContainer(t *testing.T) {
|
||||
buildCmd := exec.Command(dockerBinary, "build", "-t", "docker-test-errcreatevolumewithfile", "-")
|
||||
buildCmd.Stdin = strings.NewReader(`
|
||||
FROM busybox
|
||||
RUN touch /foo
|
||||
VOLUME /foo
|
||||
`)
|
||||
|
||||
out, _, err := runCommandWithOutput(buildCmd)
|
||||
if err == nil || !strings.Contains(out, "file exists") {
|
||||
t.Fatalf("expected build to fail when file exists in container at requested volume path")
|
||||
}
|
||||
|
||||
logDone("build - errors when volume is specified where a file exists")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user