Use nsinit for setting up namespace
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
c2777d4611
commit
593219d191
4 changed files with 17 additions and 2 deletions
|
@ -14,6 +14,10 @@ import (
|
|||
// InitNamespace should be run inside an existing namespace to setup
|
||||
// common mounts, drop capabilities, and setup network interfaces
|
||||
func InitNamespace(container *libcontainer.Container) error {
|
||||
if err := setLogFile(container); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rootfs, err := resolveRootfs(container)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -138,3 +142,12 @@ func openTerminal(name string, flag int) (*os.File, error) {
|
|||
}
|
||||
return os.NewFile(uintptr(r), name), nil
|
||||
}
|
||||
|
||||
func setLogFile(container *libcontainer.Container) error {
|
||||
f, err := os.OpenFile(container.LogFile, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0655)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.SetOutput(f)
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue