Merge pull request #405 from LK4D4/add_default_init
Add default InitArgs for factory
This commit is contained in:
commit
286fffa4ee
|
@ -21,9 +21,7 @@ To use the current binary that is spawning the containers and acting as the pare
|
|||
you can use `os.Args[0]` and we have a command called `init` setup.
|
||||
|
||||
```go
|
||||
initArgs := []string{os.Args[0], "init"}
|
||||
|
||||
root, err := libcontainer.New("/var/lib/container", initArgs)
|
||||
root, err := libcontainer.New("/var/lib/container", libcontainer.InitArgs(os.Args[0], "init"))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -90,6 +90,7 @@ func New(root string, options ...func(*LinuxFactory) error) (Factory, error) {
|
|||
Root: root,
|
||||
Validator: validate.New(),
|
||||
}
|
||||
InitArgs(os.Args[0], "init")(l)
|
||||
Cgroupfs(l)
|
||||
for _, opt := range options {
|
||||
if err := opt(l); err != nil {
|
||||
|
|
|
@ -232,7 +232,7 @@ func TestEnter(t *testing.T) {
|
|||
|
||||
config := newTemplateConfig(rootfs)
|
||||
|
||||
factory, err := libcontainer.New(root, libcontainer.InitArgs(os.Args[0], "init", "--"), libcontainer.Cgroupfs)
|
||||
factory, err := libcontainer.New(root, libcontainer.Cgroupfs)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ func TestFreeze(t *testing.T) {
|
|||
|
||||
config := newTemplateConfig(rootfs)
|
||||
|
||||
factory, err := libcontainer.New(root, libcontainer.InitArgs(os.Args[0], "init", "--"), libcontainer.Cgroupfs)
|
||||
factory, err := libcontainer.New(root, libcontainer.Cgroupfs)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue