mirror of https://github.com/docker/docs.git
Merge pull request #13542 from kvasdopil/freebsd-work
Make docker build on FreeBSD
This commit is contained in:
commit
75f8bdd970
|
@ -1,4 +1,4 @@
|
||||||
// +build linux
|
// +build freebsd linux
|
||||||
|
|
||||||
package server
|
package server
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build linux
|
// +build freebsd linux
|
||||||
|
|
||||||
package builder
|
package builder
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// +build linux freebsd
|
||||||
|
|
||||||
package daemon
|
package daemon
|
||||||
|
|
||||||
import (
|
import (
|
|
@ -1,4 +1,4 @@
|
||||||
// +build !windows
|
// +build linux freebsd
|
||||||
|
|
||||||
package daemon
|
package daemon
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build exclude_graphdriver_aufs,linux
|
// +build exclude_graphdriver_aufs,linux freebsd
|
||||||
|
|
||||||
package daemon
|
package daemon
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build !exclude_graphdriver_zfs,linux
|
// +build !exclude_graphdriver_zfs,linux !exclude_graphdriver_zfs,freebsd
|
||||||
|
|
||||||
package daemon
|
package daemon
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
// +build freebsd
|
||||||
|
|
||||||
|
package daemon
|
||||||
|
|
||||||
|
// checkExecSupport returns an error if the exec driver does not support exec,
|
||||||
|
// or nil if it is supported.
|
||||||
|
func checkExecSupport(drivername string) error {
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
// +build freebsd
|
||||||
|
|
||||||
|
package execdrivers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/docker/docker/daemon/execdriver"
|
||||||
|
"github.com/docker/docker/pkg/sysinfo"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewDriver returns a new execdriver.Driver from the given name configured with the provided options.
|
||||||
|
func NewDriver(name string, options []string, root, libPath, initPath string, sysInfo *sysinfo.SysInfo) (execdriver.Driver, error) {
|
||||||
|
switch name {
|
||||||
|
case "jail":
|
||||||
|
return nil, fmt.Errorf("jail driver not yet supported on FreeBSD")
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("unknown exec driver %s", name)
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package graphdriver
|
||||||
|
|
||||||
|
var (
|
||||||
|
// Slice of drivers that should be used in an order
|
||||||
|
priority = []string{
|
||||||
|
"zfs",
|
||||||
|
}
|
||||||
|
)
|
|
@ -1,4 +1,4 @@
|
||||||
// +build !linux,!windows
|
// +build !linux,!windows,!freebsd
|
||||||
|
|
||||||
package graphdriver
|
package graphdriver
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build linux
|
// +build linux freebsd
|
||||||
|
|
||||||
package zfs
|
package zfs
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package daemon
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/opencontainers/runc/libcontainer"
|
||||||
|
)
|
||||||
|
|
||||||
|
// convertStatsToAPITypes converts the libcontainer.Stats to the api specific
|
||||||
|
// structs. This is done to preserve API compatibility and versioning.
|
||||||
|
func convertStatsToAPITypes(ls *libcontainer.Stats) *types.Stats {
|
||||||
|
// TODO FreeBSD. Refactor accordingly to fill in stats.
|
||||||
|
s := &types.Stats{}
|
||||||
|
return s
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package daemon
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/docker/docker/runconfig"
|
||||||
|
)
|
||||||
|
|
||||||
|
func mergeLxcConfIntoOptions(hostConfig *runconfig.HostConfig) ([]string, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
// +build daemon
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "github.com/docker/docker/daemon/execdriver/lxc"
|
||||||
|
)
|
|
@ -11,7 +11,6 @@ import (
|
||||||
"github.com/docker/docker/daemon"
|
"github.com/docker/docker/daemon"
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/docker/docker/pkg/system"
|
||||||
|
|
||||||
_ "github.com/docker/docker/daemon/execdriver/lxc"
|
|
||||||
_ "github.com/docker/docker/daemon/execdriver/native"
|
_ "github.com/docker/docker/daemon/execdriver/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build linux
|
// +build linux freebsd
|
||||||
|
|
||||||
package directory
|
package directory
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package operatingsystem
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetOperatingSystem gets the name of the current operating system.
|
||||||
|
func GetOperatingSystem() (string, error) {
|
||||||
|
// TODO: Implement OS detection
|
||||||
|
return "", errors.New("Cannot detect OS version")
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsContainerized returns true if we are running inside a container.
|
||||||
|
// No-op on FreeBSD, always returns false.
|
||||||
|
func IsContainerized() (bool, error) {
|
||||||
|
// TODO: Implement jail detection
|
||||||
|
return false, errors.New("Cannot detect if we are in container")
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
// +build freebsd
|
||||||
|
|
||||||
|
package reexec
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os/exec"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Self returns the path to the current process's binary.
|
||||||
|
// Uses os.Args[0].
|
||||||
|
func Self() string {
|
||||||
|
return naiveSelf()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Command returns *exec.Cmd which have Path as current binary.
|
||||||
|
// For example if current binary is "docker" at "/usr/bin/", then cmd.Path will
|
||||||
|
// be set to "/usr/bin/docker".
|
||||||
|
func Command(args ...string) *exec.Cmd {
|
||||||
|
return &exec.Cmd{
|
||||||
|
Path: Self(),
|
||||||
|
Args: args,
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
// +build !linux,!windows
|
// +build !linux,!windows,!freebsd
|
||||||
|
|
||||||
package reexec
|
package reexec
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build linux
|
// +build linux freebsd
|
||||||
|
|
||||||
package sockets
|
package sockets
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package sysinfo
|
||||||
|
|
||||||
|
// TODO FreeBSD
|
||||||
|
func New(quiet bool) *SysInfo {
|
||||||
|
sysInfo := &SysInfo{}
|
||||||
|
return sysInfo
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package system
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
// fromStatT converts a syscall.Stat_t type to a system.Stat_t type
|
||||||
|
func fromStatT(s *syscall.Stat_t) (*Stat_t, error) {
|
||||||
|
return &Stat_t{size: s.Size,
|
||||||
|
mode: uint32(s.Mode),
|
||||||
|
uid: s.Uid,
|
||||||
|
gid: s.Gid,
|
||||||
|
rdev: uint64(s.Rdev),
|
||||||
|
mtim: s.Mtimespec}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stat takes a path to a file and returns
|
||||||
|
// a system.Stat_t type pertaining to that file.
|
||||||
|
//
|
||||||
|
// Throws an error if the file does not exist
|
||||||
|
func Stat(path string) (*Stat_t, error) {
|
||||||
|
s := &syscall.Stat_t{}
|
||||||
|
if err := syscall.Stat(path, s); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return fromStatT(s)
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
// +build !linux,!windows
|
// +build !linux,!windows,!freebsd
|
||||||
|
|
||||||
package system
|
package system
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue