Merge pull request #13744 from turtlebender/feature/whitelist-label-for-commit

Support LABEL as change for `docker commit`
This commit is contained in:
Alexander Morozov 2015-07-01 10:57:33 -07:00
commit 53b897ce9c
2 changed files with 16 additions and 0 deletions

View File

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

View File

@ -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 {