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

Update native driver to use labels from opts

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby 2014-03-27 09:04:54 +00:00
parent bfa2141765
commit 6c9a47f01c

View file

@ -2,6 +2,7 @@ package native
import ( import (
"fmt" "fmt"
"github.com/dotcloud/docker/pkg/label"
"github.com/dotcloud/docker/pkg/libcontainer" "github.com/dotcloud/docker/pkg/libcontainer"
"github.com/dotcloud/docker/runtime/execdriver" "github.com/dotcloud/docker/runtime/execdriver"
"github.com/dotcloud/docker/runtime/execdriver/native/configuration" "github.com/dotcloud/docker/runtime/execdriver/native/configuration"
@ -37,6 +38,9 @@ func (d *driver) createContainer(c *execdriver.Command) (*libcontainer.Container
if err := d.setupMounts(container, c); err != nil { if err := d.setupMounts(container, c); err != nil {
return nil, err return nil, err
} }
if err := d.setupLabels(container, c); err != nil {
return nil, err
}
if err := configuration.ParseConfiguration(container, d.activeContainers, c.Config["native"]); err != nil { if err := configuration.ParseConfiguration(container, d.activeContainers, c.Config["native"]); err != nil {
return nil, err return nil, err
} }
@ -94,3 +98,16 @@ func (d *driver) setupMounts(container *libcontainer.Container, c *execdriver.Co
} }
return nil return nil
} }
func (d *driver) setupLabels(container *libcontainer.Container, c *execdriver.Command) error {
labels := c.Config["label"]
if len(labels) > 0 {
process, mount, err := label.GenLabels(labels[0])
if err != nil {
return err
}
container.Context["mount_label"] = mount
container.Context["process_label"] = process
}
return nil
}