Add ability to work with individual namespaces

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby
2014-03-21 00:23:34 +00:00
parent 443a75d5f6
commit 70f3b9f4ce
3 changed files with 25 additions and 6 deletions
+14 -2
View File
@@ -77,10 +77,12 @@ func createContainer(c *execdriver.Command) *libcontainer.Container {
// i.e: cgroup devices.allow *:*
func configureCustomOptions(container *libcontainer.Container, opts []string) {
for _, opt := range opts {
parts := strings.Split(strings.TrimSpace(opt), " ")
var (
parts = strings.Split(strings.TrimSpace(opt), " ")
value = strings.TrimSpace(parts[1])
)
switch parts[0] {
case "cap":
value := strings.TrimSpace(parts[1])
c := container.CapabilitiesMask.Get(value[1:])
if c == nil {
continue
@@ -93,6 +95,16 @@ func configureCustomOptions(container *libcontainer.Container, opts []string) {
default:
// do error here
}
case "ns":
ns := container.Namespaces.Get(value[1:])
switch value[0] {
case '-':
ns.Enabled = false
case '+':
ns.Enabled = true
default:
// error
}
}
}
}