mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix cross compile non cgo and linux systems
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
This commit is contained in:
parent
0d67b420b5
commit
7a8ea91392
7 changed files with 41 additions and 6 deletions
|
@ -13,7 +13,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/docker/libcontainer/label"
|
||||
"github.com/docker/libcontainer/selinux"
|
||||
"github.com/dotcloud/docker/archive"
|
||||
"github.com/dotcloud/docker/daemon/execdriver"
|
||||
"github.com/dotcloud/docker/daemon/execdriver/execdrivers"
|
||||
|
@ -300,7 +299,8 @@ func (daemon *Daemon) Destroy(container *Container) error {
|
|||
if err := os.RemoveAll(container.root); err != nil {
|
||||
return fmt.Errorf("Unable to remove filesystem for %v: %v", container.ID, err)
|
||||
}
|
||||
selinux.FreeLxcContexts(container.ProcessLabel)
|
||||
|
||||
selinuxFreeLxcContexts(container.ProcessLabel)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -761,7 +761,7 @@ func NewDaemon(config *daemonconfig.Config, eng *engine.Engine) (*Daemon, error)
|
|||
|
||||
func NewDaemonFromDirectory(config *daemonconfig.Config, eng *engine.Engine) (*Daemon, error) {
|
||||
if !config.EnableSelinuxSupport {
|
||||
selinux.SetDisabled()
|
||||
selinuxSetDisabled()
|
||||
}
|
||||
|
||||
// Create the root directory if it doesn't exists
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// +build linux
|
||||
// +build linux,cgo
|
||||
|
||||
package native
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// +build linux
|
||||
// +build linux,cgo
|
||||
|
||||
package native
|
||||
|
||||
|
|
13
daemon/execdriver/native/driver_unsupported_nocgo.go
Normal file
13
daemon/execdriver/native/driver_unsupported_nocgo.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
// +build linux,!cgo
|
||||
|
||||
package native
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/dotcloud/docker/daemon/execdriver"
|
||||
)
|
||||
|
||||
func NewDriver(root, initPath string) (execdriver.Driver, error) {
|
||||
return nil, fmt.Errorf("native driver not supported on non-linux")
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// +build linux
|
||||
// +build linux,cgo
|
||||
|
||||
package native
|
||||
|
||||
|
|
13
daemon/utils_linux.go
Normal file
13
daemon/utils_linux.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
// +build linux
|
||||
|
||||
package daemon
|
||||
|
||||
import "github.com/docker/libcontainer/selinux"
|
||||
|
||||
func selinuxSetDisabled() {
|
||||
selinux.SetDisabled()
|
||||
}
|
||||
|
||||
func selinuxFreeLxcContexts(label string) {
|
||||
selinux.FreeLxcContexts(label)
|
||||
}
|
9
daemon/utils_nolinux.go
Normal file
9
daemon/utils_nolinux.go
Normal file
|
@ -0,0 +1,9 @@
|
|||
// +build !linux
|
||||
|
||||
package daemon
|
||||
|
||||
func selinuxSetDisabled() {
|
||||
}
|
||||
|
||||
func selinuxFreeLxcContexts(label string) {
|
||||
}
|
Loading…
Add table
Reference in a new issue