1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #15503 from ibuildthecloud/revert-label

Revert "Container don't inherit from image labels"
This commit is contained in:
Arnaud Porterie 2015-10-12 10:03:18 -07:00
commit b0cbc02283
2 changed files with 11 additions and 1 deletions

View file

@ -234,7 +234,7 @@ func (s *DockerSuite) TestCreateLabelFromImage(c *check.C) {
}
name := "test_create_labels_from_image"
expected := map[string]string{"k2": "x", "k3": "v3"}
expected := map[string]string{"k2": "x", "k3": "v3", "k1": "v1"}
dockerCmd(c, "create", "--name", name, "-l", "k2=x", "--label", "k3=v3", imageName)
actual := make(map[string]string)

View file

@ -47,6 +47,16 @@ func Merge(userConf, imageConf *Config) error {
}
}
if userConf.Labels == nil {
userConf.Labels = map[string]string{}
}
if imageConf.Labels != nil {
for l := range userConf.Labels {
imageConf.Labels[l] = userConf.Labels[l]
}
userConf.Labels = imageConf.Labels
}
if userConf.Entrypoint.Len() == 0 {
if userConf.Cmd.Len() == 0 {
userConf.Cmd = imageConf.Cmd