Browse Source

No options to tmpfs is valid

If you run a

docker run command with --tmpfs /mountpoint:noexec

Or certain options that get translated into mount options, the mount command can get passed "" for mount data.
So this should be valid.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Dan Walsh 9 years ago
parent
commit
89a775d2dc
2 changed files with 4 additions and 0 deletions
  1. 3 0
      integration-cli/docker_cli_run_unix_test.go
  2. 1 0
      pkg/mount/flags.go

+ 3 - 0
integration-cli/docker_cli_run_unix_test.go

@@ -479,6 +479,9 @@ func (s *DockerSuite) TestRunTmpfsMounts(c *check.C) {
 	if out, _, err := dockerCmdWithError("run", "--tmpfs", "/run", "busybox", "touch", "/run/somefile"); err != nil {
 	if out, _, err := dockerCmdWithError("run", "--tmpfs", "/run", "busybox", "touch", "/run/somefile"); err != nil {
 		c.Fatalf("/run directory not mounted on tmpfs %q %s", err, out)
 		c.Fatalf("/run directory not mounted on tmpfs %q %s", err, out)
 	}
 	}
+	if out, _, err := dockerCmdWithError("run", "--tmpfs", "/run:noexec", "busybox", "touch", "/run/somefile"); err != nil {
+		c.Fatalf("/run directory not mounted on tmpfs %q %s", err, out)
+	}
 	if out, _, err := dockerCmdWithError("run", "--tmpfs", "/run:noexec,nosuid,rw,size=5k,mode=700", "busybox", "touch", "/run/somefile"); err != nil {
 	if out, _, err := dockerCmdWithError("run", "--tmpfs", "/run:noexec,nosuid,rw,size=5k,mode=700", "busybox", "touch", "/run/somefile"); err != nil {
 		c.Fatalf("/run failed to mount on tmpfs with valid options %q %s", err, out)
 		c.Fatalf("/run failed to mount on tmpfs with valid options %q %s", err, out)
 	}
 	}

+ 1 - 0
pkg/mount/flags.go

@@ -73,6 +73,7 @@ func parseOptions(options string) (int, string) {
 func ParseTmpfsOptions(options string) (int, string, error) {
 func ParseTmpfsOptions(options string) (int, string, error) {
 	flags, data := parseOptions(options)
 	flags, data := parseOptions(options)
 	validFlags := map[string]bool{
 	validFlags := map[string]bool{
+		"":          true,
 		"size":      true,
 		"size":      true,
 		"mode":      true,
 		"mode":      true,
 		"uid":       true,
 		"uid":       true,