浏览代码

Relabel config files.

Without relabel these files, SELinux-enabled containers will show
"permission denied" errors for configuration files mounted with
`docker server create ... --config ... ...`.

Signed-off-by: Wenxuan Zhao <viz@linux.com>
Wenxuan Zhao 7 年之前
父节点
当前提交
472c03a8c3
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      daemon/container_operations_unix.go

+ 2 - 0
daemon/container_operations_unix.go

@@ -307,6 +307,8 @@ func (daemon *Daemon) setupConfigDir(c *container.Container) (setupErr error) {
 		if err := os.Chown(fPath, rootIDs.UID+uid, rootIDs.GID+gid); err != nil {
 		if err := os.Chown(fPath, rootIDs.UID+uid, rootIDs.GID+gid); err != nil {
 			return errors.Wrap(err, "error setting ownership for config")
 			return errors.Wrap(err, "error setting ownership for config")
 		}
 		}
+
+		label.Relabel(fPath, c.MountLabel, false)
 	}
 	}
 
 
 	return nil
 	return nil