71 lines
1.4 KiB
Go
71 lines
1.4 KiB
Go
package integration
|
|
|
|
import (
|
|
"syscall"
|
|
|
|
"github.com/docker/libcontainer/configs"
|
|
)
|
|
|
|
var standardEnvironment = []string{
|
|
"HOME=/root",
|
|
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
|
"HOSTNAME=integration",
|
|
"TERM=xterm",
|
|
}
|
|
|
|
// newTemplateConfig returns a base template for running a container
|
|
//
|
|
// it uses a network strategy of just setting a loopback interface
|
|
// and the default setup for devices
|
|
func newTemplateConfig(rootfs string) *configs.Config {
|
|
return &configs.Config{
|
|
Rootfs: rootfs,
|
|
Capabilities: []string{
|
|
"CHOWN",
|
|
"DAC_OVERRIDE",
|
|
"FSETID",
|
|
"FOWNER",
|
|
"MKNOD",
|
|
"NET_RAW",
|
|
"SETGID",
|
|
"SETUID",
|
|
"SETFCAP",
|
|
"SETPCAP",
|
|
"NET_BIND_SERVICE",
|
|
"SYS_CHROOT",
|
|
"KILL",
|
|
"AUDIT_WRITE",
|
|
},
|
|
Namespaces: configs.Namespaces([]configs.Namespace{
|
|
{Type: configs.NEWNS},
|
|
{Type: configs.NEWUTS},
|
|
{Type: configs.NEWIPC},
|
|
{Type: configs.NEWPID},
|
|
{Type: configs.NEWNET},
|
|
}),
|
|
Cgroups: &configs.Cgroup{
|
|
Name: "test",
|
|
Parent: "integration",
|
|
AllowAllDevices: false,
|
|
AllowedDevices: configs.DefaultAllowedDevices,
|
|
},
|
|
|
|
Devices: configs.DefaultAutoCreatedDevices,
|
|
Hostname: "integration",
|
|
Networks: []*configs.Network{
|
|
{
|
|
Type: "loopback",
|
|
Address: "127.0.0.1/0",
|
|
Gateway: "localhost",
|
|
},
|
|
},
|
|
Rlimits: []configs.Rlimit{
|
|
{
|
|
Type: syscall.RLIMIT_NOFILE,
|
|
Hard: uint64(1024),
|
|
Soft: uint64(1024),
|
|
},
|
|
},
|
|
}
|
|
}
|