github.com/docker/docker@v299999999.0.0-20200612211812-aaf470eca7b5+incompatible/daemon/container_linux.go (about)

     1  //+build !windows
     2  
     3  package daemon // import "github.com/docker/docker/daemon"
     4  
     5  import (
     6  	"github.com/docker/docker/container"
     7  	"github.com/docker/docker/errdefs"
     8  )
     9  
    10  func (daemon *Daemon) saveAppArmorConfig(container *container.Container) error {
    11  	container.AppArmorProfile = "" // we don't care about the previous value.
    12  
    13  	if !daemon.apparmorEnabled {
    14  		return nil // if apparmor is disabled there is nothing to do here.
    15  	}
    16  
    17  	if err := parseSecurityOpt(container, container.HostConfig); err != nil {
    18  		return errdefs.InvalidParameter(err)
    19  	}
    20  
    21  	if !container.HostConfig.Privileged {
    22  		if container.AppArmorProfile == "" {
    23  			container.AppArmorProfile = defaultAppArmorProfile
    24  		}
    25  
    26  	} else {
    27  		container.AppArmorProfile = unconfinedAppArmorProfile
    28  	}
    29  	return nil
    30  }