func (d *driver) createContainer(c *execdriver.Command) (*libcontainer.Container, error) {
	container := template.New()

	container.Hostname = getEnv("HOSTNAME", c.Env)
	container.Tty = c.Tty
	container.User = c.User
	container.WorkingDir = c.WorkingDir
	container.Env = c.Env
	container.Cgroups.Name = c.ID
	container.Cgroups.AllowedDevices = c.AllowedDevices
	container.DeviceNodes = c.AutoCreatedDevices
	// check to see if we are running in ramdisk to disable pivot root
	container.NoPivotRoot = os.Getenv("DOCKER_RAMDISK") != ""
	container.Context["restrictions"] = "true"

	if err := d.createNetwork(container, c); err != nil {
		return nil, err
	}
	if c.Privileged {
		if err := d.setPrivileged(container); err != nil {
			return nil, err
		}
	}
	if err := d.setupCgroups(container, c); err != nil {
		return nil, err
	}
	if err := d.setupMounts(container, c); err != nil {
		return nil, err
	}
	if err := d.setupLabels(container, c); err != nil {
		return nil, err
	}
	cmds := make(map[string]*exec.Cmd)
	d.Lock()
	for k, v := range d.activeContainers {
		cmds[k] = v.cmd
	}
	d.Unlock()
	if err := configuration.ParseConfiguration(container, cmds, c.Config["native"]); err != nil {
		return nil, err
	}
	return container, nil
}
// createContainer populates and configures the container type with the
// data provided by the execdriver.Command
createContainer populates and configures the container type with the
data provided by the execdriver.Command
// createContainer populates and configures the container type with the // data provided by the execdriver . Command
func (d *driver) createContainer(c *execdriver.Command) (*libcontainer.Container, error) {
	container := template.New()
	container.Hostname = getEnv("HOSTNAME", c.Env)
	container.Tty = c.Tty
	container.User = c.User
	container.WorkingDir = c.WorkingDir
	container.Env = c.Env
	container.Cgroups.Name = c.ID
	container.Cgroups.AllowedDevices = c.AllowedDevices
	container.DeviceNodes = c.AutoCreatedDevices
	container.NoPivotRoot = os.Getenv("DOCKER_RAMDISK") != ""
	container.Context["restrictions"] = "true"
	if err := d.createNetwork(container, c); err != nil {
		return nil, err
	}
	if c.Privileged {
		if err := d.setPrivileged(container); err != nil {
			return nil, err
		}
	}
	if err := d.setupCgroups(container, c); err != nil {
		return nil, err
	}
	if err := d.setupMounts(container, c); err != nil {
		return nil, err
	}
	if err := d.setupLabels(container, c); err != nil {
		return nil, err
	}
	cmds := make(map[string]*exec.Cmd)
	d.Lock()
	for k, v := range d.activeContainers {
		cmds[k] = v.cmd
	}
	d.Unlock()
	if err := configuration.ParseConfiguration(container, cmds, c.Config["native"]); err != nil {
		return nil, err
	}
	return container, nil
}
func ( d * driver ) createContainer ( c * execdriver . Command ) ( * libcontainer . Container , error ) { container := template . New ( ) container . Hostname = getEnv ( " " , c . Env ) container . Tty = c . Tty container . User = c . User container . WorkingDir = c . WorkingDir container . Env = c . Env container . Cgroups . Name = c . ID container . Cgroups . AllowedDevices = c . AllowedDevices container . DeviceNodes = c . AutoCreatedDevices container . NoPivotRoot = os . Getenv ( " " ) != " " container . Context [ " " ] = " " if err := d . createNetwork ( container , c ) ; err != nil { return nil , err } if c . Privileged { if err := d . setPrivileged ( container ) ; err != nil { return nil , err } } if err := d . setupCgroups ( container , c ) ; err != nil { return nil , err } if err := d . setupMounts ( container , c ) ; err != nil { return nil , err } if err := d . setupLabels ( container , c ) ; err != nil { return nil , err } cmds := make ( map [ string ] * exec . Cmd ) d . Lock ( ) for k , v := range d . activeContainers { cmds [ k ] = v . cmd } d . Unlock ( ) if err := configuration . ParseConfiguration ( container , cmds , c . Config [ " " ] ) ; err != nil { return nil , err } return container , nil }
createContainer populates and configures the container type with the
data provided by the execdriver.Command
createContainer populates and configures the container type with the data provided by the execdriver . Command
// check to see if we are running in ramdisk to disable pivot root