mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-04 12:41:42 +00:00
Do not parse config.Volumes for named volumes
Fixes an issue where `VOLUME some_name:/foo` would be parsed as a named volume, allowing access from the builder to any volume on the host. This makes sure that named volumes must always be passed in as a bind. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
@@ -5641,7 +5641,7 @@ func (s *DockerSuite) TestBuildNullStringInAddCopyVolume(c *check.C) {
|
||||
|
||||
ctx, err := fakeContext(`
|
||||
FROM busybox
|
||||
|
||||
|
||||
ADD null /
|
||||
COPY nullfile /
|
||||
VOLUME nullvolume
|
||||
@@ -6194,3 +6194,15 @@ func (s *DockerSuite) TestBuildBuildTimeArgDefintionWithNoEnvInjection(c *check.
|
||||
c.Fatalf("unexpected number of occurrences of the arg in output: %q expected: 1", out)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildNoNamedVolume(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "-v", "testname:/foo", "busybox", "sh", "-c", "touch /foo/oops")
|
||||
|
||||
dockerFile := `FROM busybox
|
||||
VOLUME testname:/foo
|
||||
RUN ls /foo/oops
|
||||
`
|
||||
_, err := buildImage("test", dockerFile, false)
|
||||
c.Assert(err, check.NotNil, check.Commentf("image build should have failed"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user