diff --git a/components/engine/graphdriver/aufs/aufs.go b/components/engine/graphdriver/aufs/aufs.go index 558c64c5bb..c3caf13c13 100644 --- a/components/engine/graphdriver/aufs/aufs.go +++ b/components/engine/graphdriver/aufs/aufs.go @@ -30,7 +30,6 @@ import ( "os/exec" "path" "strings" - "syscall" ) func init() { @@ -327,7 +326,7 @@ func (a *Driver) aufsMount(ro []string, rw, target string) (err error) { for _, layer := range ro { branch := fmt.Sprintf("append:%s=ro+wh", layer) - if err = mount("none", target, "aufs", syscall.MS_REMOUNT, branch); err != nil { + if err = mount("none", target, "aufs", MsRemount, branch); err != nil { return } } diff --git a/components/engine/graphdriver/aufs/mount_darwin.go b/components/engine/graphdriver/aufs/mount_darwin.go index ce448036f2..62c84fc7c9 100644 --- a/components/engine/graphdriver/aufs/mount_darwin.go +++ b/components/engine/graphdriver/aufs/mount_darwin.go @@ -2,6 +2,8 @@ package aufs import "errors" +const MsRemount = 0 + func mount(source string, target string, fstype string, flags uintptr, data string) (err error) { return errors.New("mount is not implemented on darwin") } diff --git a/components/engine/graphdriver/aufs/mount_linux.go b/components/engine/graphdriver/aufs/mount_linux.go index 8062bae420..c86f1bbd63 100644 --- a/components/engine/graphdriver/aufs/mount_linux.go +++ b/components/engine/graphdriver/aufs/mount_linux.go @@ -2,6 +2,8 @@ package aufs import "syscall" +const MsRemount = syscall.MS_REMOUNT + func mount(source string, target string, fstype string, flags uintptr, data string) error { return syscall.Mount(source, target, fstype, flags, data) } diff --git a/components/engine/sysinit/sysinit.go b/components/engine/sysinit/sysinit.go index 2dc5967dc6..ad97439450 100644 --- a/components/engine/sysinit/sysinit.go +++ b/components/engine/sysinit/sysinit.go @@ -32,7 +32,7 @@ func setupHostname(args *DockerInitArgs) error { if hostname == "" { return nil } - return syscall.Sethostname([]byte(hostname)) + return setHostname(hostname) } // Setup networking diff --git a/components/engine/sysinit/sysinit_darwin.go b/components/engine/sysinit/sysinit_darwin.go new file mode 100644 index 0000000000..64566afb3c --- /dev/null +++ b/components/engine/sysinit/sysinit_darwin.go @@ -0,0 +1,5 @@ +package sysinit + +func setHostname(hostname string) error { + panic("Not supported on darwin") +} diff --git a/components/engine/sysinit/sysinit_linux.go b/components/engine/sysinit/sysinit_linux.go new file mode 100644 index 0000000000..d18d2fab8b --- /dev/null +++ b/components/engine/sysinit/sysinit_linux.go @@ -0,0 +1,9 @@ +package sysinit + +import ( + "syscall" +) + +func setHostname(hostname string) error { + return syscall.Sethostname([]byte(hostname)) +}