From 8a8dcf1930cbd3354994938d5f8e420fb3e66d95 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Mon, 19 Jan 2015 12:09:02 -0500 Subject: [PATCH] Turn on Security opts including labeling for docker build Currently docker build is not passing HostConfig to daemon.Create. this patch creates the default HostConfig and passes it to daemon.Create. This will cause the SELinux labeling to turn on for docker build. Basically it causes a SecurtyOpt field to be created. In the future this might also allow us to use seccomp and UserNamespace with docker build. Docker-DCO-1.1-Signed-off-by: Dan Walsh (github: rhatdan) --- daemon/create.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/daemon/create.go b/daemon/create.go index 785b0cc345..1377d36b6d 100644 --- a/daemon/create.go +++ b/daemon/create.go @@ -91,7 +91,10 @@ func (daemon *Daemon) Create(config *runconfig.Config, hostConfig *runconfig.Hos if warnings, err = daemon.mergeAndVerifyConfig(config, img); err != nil { return nil, nil, err } - if hostConfig != nil && hostConfig.SecurityOpt == nil { + if hostConfig == nil { + hostConfig = &runconfig.HostConfig{} + } + if hostConfig.SecurityOpt == nil { hostConfig.SecurityOpt, err = daemon.GenerateSecurityOpt(hostConfig.IpcMode, hostConfig.PidMode) if err != nil { return nil, nil, err