container_linux.go 643 B

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