瀏覽代碼

just adding label to whitelist for commit command (Fixes #13738)

Signed-off-by: Tom Howe <turtlebender@gmail.com>
Tom Howe 10 年之前
父節點
當前提交
6e2662b3ba
共有 2 個文件被更改,包括 16 次插入0 次删除
  1. 2 0
      builder/job.go
  2. 14 0
      integration-cli/docker_cli_commit_test.go

+ 2 - 0
builder/job.go

@@ -34,6 +34,8 @@ var validCommitCommands = map[string]bool{
 	"volume":     true,
 	"expose":     true,
 	"onbuild":    true,
+	"label":      true,
+	"maintainer": true,
 }
 
 type Config struct {

+ 14 - 0
integration-cli/docker_cli_commit_test.go

@@ -223,6 +223,13 @@ func (s *DockerSuite) TestCommitChange(c *check.C) {
 		"--change", "ENV DEBUG true",
 		"--change", "ENV test 1",
 		"--change", "ENV PATH /foo",
+		"--change", "LABEL foo bar",
+		"--change", "CMD [\"/bin/sh\"]",
+		"--change", "WORKDIR /opt",
+		"--change", "ENTRYPOINT [\"/bin/sh\"]",
+		"--change", "USER testuser",
+		"--change", "VOLUME /var/lib/docker",
+		"--change", "ONBUILD /usr/local/bin/python-build --dir /app/src",
 		"test", "test-commit")
 	imageId, _, err := runCommandWithOutput(cmd)
 	if err != nil {
@@ -233,6 +240,13 @@ func (s *DockerSuite) TestCommitChange(c *check.C) {
 	expected := map[string]string{
 		"Config.ExposedPorts": "map[8080/tcp:{}]",
 		"Config.Env":          "[DEBUG=true test=1 PATH=/foo]",
+		"Config.Labels":       "map[foo:bar]",
+		"Config.Cmd":          "{[/bin/sh]}",
+		"Config.WorkingDir":   "/opt",
+		"Config.Entrypoint":   "{[/bin/sh]}",
+		"Config.User":         "testuser",
+		"Config.Volumes":      "map[/var/lib/docker:{}]",
+		"Config.OnBuild":      "[/usr/local/bin/python-build --dir /app/src]",
 	}
 
 	for conf, value := range expected {