Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNamespaceFlags ¶
func GetNamespaceFlags(namespaces libcontainer.Namespaces) (flag int)
GetNamespaceFlags parses the container's Namespaces options to set the correct flags on clone, unshare, and setns
Types ¶
type CommandFactory ¶
type CommandFactory interface {
Create(container *libcontainer.Container, console string, syncFd *os.File, args []string) *exec.Cmd
}
CommandFactory takes the container's configuration and options passed by the parent processes and creates an *exec.Cmd that will be used to fork/exec the namespaced init process
type DefaultCommandFactory ¶
type DefaultCommandFactory struct {
Root string
}
func (*DefaultCommandFactory) Create ¶
func (c *DefaultCommandFactory) Create(container *libcontainer.Container, console string, pipe *os.File, args []string) *exec.Cmd
Create will return an exec.Cmd with the Cloneflags set to the proper namespaces defined on the container's configuration and use the current binary as the init with the args provided
type DefaultStateWriter ¶
type DefaultStateWriter struct {
Root string
}
func (*DefaultStateWriter) DeletePid ¶
func (d *DefaultStateWriter) DeletePid() error
func (*DefaultStateWriter) WritePid ¶
func (d *DefaultStateWriter) WritePid(pid int) error
writePidFile writes the namespaced processes pid to pid in the rootfs for the container
type NsInit ¶
type NsInit interface { Exec(container *libcontainer.Container, term Terminal, args []string) (int, error) ExecIn(container *libcontainer.Container, nspid int, args []string) (int, error) Init(container *libcontainer.Container, uncleanRootfs, console string, syncPipe *SyncPipe, args []string) error }
NsInit is an interface with the public facing methods to provide high level exec operations on a container
func NewNsInit ¶
func NewNsInit(command CommandFactory, state StateWriter, logger *log.Logger) NsInit
type StateWriter ¶
StateWriter handles writing and deleting the pid file on disk
type StdTerminal ¶
type StdTerminal struct {
// contains filtered or unexported fields
}
func (*StdTerminal) Close ¶
func (s *StdTerminal) Close() error
func (*StdTerminal) Resize ¶
func (s *StdTerminal) Resize(h, w int) error
func (*StdTerminal) SetMaster ¶
func (s *StdTerminal) SetMaster(*os.File)
type SyncPipe ¶
type SyncPipe struct {
// contains filtered or unexported fields
}
SyncPipe allows communication to and from the child processes to it's parent and allows the two independent processes to syncronize their state.
func NewSyncPipe ¶
func NewSyncPipeFromFd ¶
func (*SyncPipe) ReadFromParent ¶
func (s *SyncPipe) ReadFromParent() (libcontainer.Context, error)
func (*SyncPipe) SendToChild ¶
func (s *SyncPipe) SendToChild(context libcontainer.Context) error
type Terminal ¶
type TtyTerminal ¶
type TtyTerminal struct {
// contains filtered or unexported fields
}
func (*TtyTerminal) Close ¶
func (t *TtyTerminal) Close() error
func (*TtyTerminal) Resize ¶
func (t *TtyTerminal) Resize(h, w int) error
func (*TtyTerminal) SetMaster ¶
func (t *TtyTerminal) SetMaster(master *os.File)