Solaris is no longer being worked on, so these files
are now just dead code.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,15 +0,0 @@ |
| 1 |
-package main |
|
| 2 |
- |
|
| 3 |
-import ( |
|
| 4 |
- "github.com/docker/docker/daemon/config" |
|
| 5 |
- "github.com/spf13/pflag" |
|
| 6 |
-) |
|
| 7 |
- |
|
| 8 |
-// installConfigFlags adds flags to the pflag.FlagSet to configure the daemon |
|
| 9 |
-func installConfigFlags(conf *config.Config, flags *pflag.FlagSet) {
|
|
| 10 |
- // First handle install flags which are consistent cross-platform |
|
| 11 |
- installCommonConfigFlags(conf, flags) |
|
| 12 |
- |
|
| 13 |
- // Then install flags common to unix platforms |
|
| 14 |
- installUnixConfigFlags(conf, flags) |
|
| 15 |
-} |
| 16 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,7 +0,0 @@ |
| 1 |
-package container |
|
| 2 |
- |
|
| 3 |
-// setFromExitStatus is a platform specific helper function to set the state |
|
| 4 |
-// based on the ExitStatus structure. |
|
| 5 |
-func (s *State) setFromExitStatus(exitStatus *ExitStatus) {
|
|
| 6 |
- s.ExitCodeValue = exitStatus.ExitCode |
|
| 7 |
-} |
| 6 | 4 |
deleted file mode 100644 |
| ... | ... |
@@ -1,57 +0,0 @@ |
| 1 |
-package cluster |
|
| 2 |
- |
|
| 3 |
-import ( |
|
| 4 |
- "bufio" |
|
| 5 |
- "fmt" |
|
| 6 |
- "net" |
|
| 7 |
- "os/exec" |
|
| 8 |
- "strings" |
|
| 9 |
-) |
|
| 10 |
- |
|
| 11 |
-func (c *Cluster) resolveSystemAddr() (net.IP, error) {
|
|
| 12 |
- defRouteCmd := "/usr/sbin/ipadm show-addr -p -o addr " + |
|
| 13 |
- "`/usr/sbin/route get default | /usr/bin/grep interface | " + |
|
| 14 |
- "/usr/bin/awk '{print $2}'`"
|
|
| 15 |
- out, err := exec.Command("/usr/bin/bash", "-c", defRouteCmd).Output()
|
|
| 16 |
- if err != nil {
|
|
| 17 |
- return nil, fmt.Errorf("cannot get default route: %v", err)
|
|
| 18 |
- } |
|
| 19 |
- |
|
| 20 |
- defInterface := strings.SplitN(string(out), "/", 2) |
|
| 21 |
- defInterfaceIP := net.ParseIP(defInterface[0]) |
|
| 22 |
- |
|
| 23 |
- return defInterfaceIP, nil |
|
| 24 |
-} |
|
| 25 |
- |
|
| 26 |
-func listSystemIPs() []net.IP {
|
|
| 27 |
- var systemAddrs []net.IP |
|
| 28 |
- cmd := exec.Command("/usr/sbin/ipadm", "show-addr", "-p", "-o", "addr")
|
|
| 29 |
- cmdReader, err := cmd.StdoutPipe() |
|
| 30 |
- if err != nil {
|
|
| 31 |
- return nil |
|
| 32 |
- } |
|
| 33 |
- |
|
| 34 |
- if err := cmd.Start(); err != nil {
|
|
| 35 |
- return nil |
|
| 36 |
- } |
|
| 37 |
- |
|
| 38 |
- scanner := bufio.NewScanner(cmdReader) |
|
| 39 |
- go func() {
|
|
| 40 |
- for scanner.Scan() {
|
|
| 41 |
- text := scanner.Text() |
|
| 42 |
- nameAddrPair := strings.SplitN(text, "/", 2) |
|
| 43 |
- // Let go of loopback interfaces and docker interfaces |
|
| 44 |
- systemAddrs = append(systemAddrs, net.ParseIP(nameAddrPair[0])) |
|
| 45 |
- } |
|
| 46 |
- }() |
|
| 47 |
- |
|
| 48 |
- if err := scanner.Err(); err != nil {
|
|
| 49 |
- fmt.Printf("scan underwent err: %+v\n", err)
|
|
| 50 |
- } |
|
| 51 |
- |
|
| 52 |
- if err := cmd.Wait(); err != nil {
|
|
| 53 |
- fmt.Printf("run command wait: %+v\n", err)
|
|
| 54 |
- } |
|
| 55 |
- |
|
| 56 |
- return systemAddrs |
|
| 57 |
-} |
| 58 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,30 +0,0 @@ |
| 1 |
-package config |
|
| 2 |
- |
|
| 3 |
-// Config defines the configuration of a docker daemon. |
|
| 4 |
-// These are the configuration settings that you pass |
|
| 5 |
-// to the docker daemon when you launch it with say: `docker -d -e lxc` |
|
| 6 |
-type Config struct {
|
|
| 7 |
- CommonConfig |
|
| 8 |
- |
|
| 9 |
- // These fields are common to all unix platforms. |
|
| 10 |
- CommonUnixConfig |
|
| 11 |
-} |
|
| 12 |
- |
|
| 13 |
-// BridgeConfig stores all the bridge driver specific |
|
| 14 |
-// configuration. |
|
| 15 |
-type BridgeConfig struct {
|
|
| 16 |
- commonBridgeConfig |
|
| 17 |
- |
|
| 18 |
- // Fields below here are platform specific. |
|
| 19 |
- commonUnixBridgeConfig |
|
| 20 |
-} |
|
| 21 |
- |
|
| 22 |
-// IsSwarmCompatible defines if swarm mode can be enabled in this config |
|
| 23 |
-func (conf *Config) IsSwarmCompatible() error {
|
|
| 24 |
- return nil |
|
| 25 |
-} |
|
| 26 |
- |
|
| 27 |
-// ValidatePlatformConfig checks if any platform-specific configuration settings are invalid. |
|
| 28 |
-func (conf *Config) ValidatePlatformConfig() error {
|
|
| 29 |
- return nil |
|
| 30 |
-} |
| 31 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,11 +0,0 @@ |
| 1 |
-package daemon |
|
| 2 |
- |
|
| 3 |
-import ( |
|
| 4 |
- "github.com/docker/docker/container" |
|
| 5 |
- "github.com/docker/docker/daemon/exec" |
|
| 6 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 7 |
-) |
|
| 8 |
- |
|
| 9 |
-func (daemon *Daemon) execSetPlatformOpt(_ *container.Container, _ *exec.Config, _ *specs.Process) error {
|
|
| 10 |
- return nil |
|
| 11 |
-} |
| 12 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,73 @@ |
| 0 |
+package daemon |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "github.com/docker/docker/api/types" |
|
| 4 |
+ "github.com/docker/docker/api/types/backend" |
|
| 5 |
+ "github.com/docker/docker/api/types/versions/v1p19" |
|
| 6 |
+ "github.com/docker/docker/container" |
|
| 7 |
+ "github.com/docker/docker/daemon/exec" |
|
| 8 |
+) |
|
| 9 |
+ |
|
| 10 |
+// This sets platform-specific fields |
|
| 11 |
+func setPlatformSpecificContainerFields(container *container.Container, contJSONBase *types.ContainerJSONBase) *types.ContainerJSONBase {
|
|
| 12 |
+ contJSONBase.AppArmorProfile = container.AppArmorProfile |
|
| 13 |
+ contJSONBase.ResolvConfPath = container.ResolvConfPath |
|
| 14 |
+ contJSONBase.HostnamePath = container.HostnamePath |
|
| 15 |
+ contJSONBase.HostsPath = container.HostsPath |
|
| 16 |
+ |
|
| 17 |
+ return contJSONBase |
|
| 18 |
+} |
|
| 19 |
+ |
|
| 20 |
+// containerInspectPre120 gets containers for pre 1.20 APIs. |
|
| 21 |
+func (daemon *Daemon) containerInspectPre120(name string) (*v1p19.ContainerJSON, error) {
|
|
| 22 |
+ container, err := daemon.GetContainer(name) |
|
| 23 |
+ if err != nil {
|
|
| 24 |
+ return nil, err |
|
| 25 |
+ } |
|
| 26 |
+ |
|
| 27 |
+ container.Lock() |
|
| 28 |
+ defer container.Unlock() |
|
| 29 |
+ |
|
| 30 |
+ base, err := daemon.getInspectData(container) |
|
| 31 |
+ if err != nil {
|
|
| 32 |
+ return nil, err |
|
| 33 |
+ } |
|
| 34 |
+ |
|
| 35 |
+ volumes := make(map[string]string) |
|
| 36 |
+ volumesRW := make(map[string]bool) |
|
| 37 |
+ for _, m := range container.MountPoints {
|
|
| 38 |
+ volumes[m.Destination] = m.Path() |
|
| 39 |
+ volumesRW[m.Destination] = m.RW |
|
| 40 |
+ } |
|
| 41 |
+ |
|
| 42 |
+ config := &v1p19.ContainerConfig{
|
|
| 43 |
+ Config: container.Config, |
|
| 44 |
+ MacAddress: container.Config.MacAddress, |
|
| 45 |
+ NetworkDisabled: container.Config.NetworkDisabled, |
|
| 46 |
+ ExposedPorts: container.Config.ExposedPorts, |
|
| 47 |
+ VolumeDriver: container.HostConfig.VolumeDriver, |
|
| 48 |
+ Memory: container.HostConfig.Memory, |
|
| 49 |
+ MemorySwap: container.HostConfig.MemorySwap, |
|
| 50 |
+ CPUShares: container.HostConfig.CPUShares, |
|
| 51 |
+ CPUSet: container.HostConfig.CpusetCpus, |
|
| 52 |
+ } |
|
| 53 |
+ networkSettings := daemon.getBackwardsCompatibleNetworkSettings(container.NetworkSettings) |
|
| 54 |
+ |
|
| 55 |
+ return &v1p19.ContainerJSON{
|
|
| 56 |
+ ContainerJSONBase: base, |
|
| 57 |
+ Volumes: volumes, |
|
| 58 |
+ VolumesRW: volumesRW, |
|
| 59 |
+ Config: config, |
|
| 60 |
+ NetworkSettings: networkSettings, |
|
| 61 |
+ }, nil |
|
| 62 |
+} |
|
| 63 |
+ |
|
| 64 |
+func inspectExecProcessConfig(e *exec.Config) *backend.ExecProcessConfig {
|
|
| 65 |
+ return &backend.ExecProcessConfig{
|
|
| 66 |
+ Tty: e.Tty, |
|
| 67 |
+ Entrypoint: e.Entrypoint, |
|
| 68 |
+ Arguments: e.Args, |
|
| 69 |
+ Privileged: &e.Privileged, |
|
| 70 |
+ User: e.User, |
|
| 71 |
+ } |
|
| 72 |
+} |
| 0 | 73 |
deleted file mode 100644 |
| ... | ... |
@@ -1,27 +0,0 @@ |
| 1 |
-package daemon |
|
| 2 |
- |
|
| 3 |
-import ( |
|
| 4 |
- "github.com/docker/docker/api/types" |
|
| 5 |
- "github.com/docker/docker/api/types/backend" |
|
| 6 |
- "github.com/docker/docker/api/types/versions/v1p19" |
|
| 7 |
- "github.com/docker/docker/container" |
|
| 8 |
- "github.com/docker/docker/daemon/exec" |
|
| 9 |
-) |
|
| 10 |
- |
|
| 11 |
-// This sets platform-specific fields |
|
| 12 |
-func setPlatformSpecificContainerFields(container *container.Container, contJSONBase *types.ContainerJSONBase) *types.ContainerJSONBase {
|
|
| 13 |
- return contJSONBase |
|
| 14 |
-} |
|
| 15 |
- |
|
| 16 |
-// containerInspectPre120 get containers for pre 1.20 APIs. |
|
| 17 |
-func (daemon *Daemon) containerInspectPre120(name string) (*v1p19.ContainerJSON, error) {
|
|
| 18 |
- return &v1p19.ContainerJSON{}, nil
|
|
| 19 |
-} |
|
| 20 |
- |
|
| 21 |
-func inspectExecProcessConfig(e *exec.Config) *backend.ExecProcessConfig {
|
|
| 22 |
- return &backend.ExecProcessConfig{
|
|
| 23 |
- Tty: e.Tty, |
|
| 24 |
- Entrypoint: e.Entrypoint, |
|
| 25 |
- Arguments: e.Args, |
|
| 26 |
- } |
|
| 27 |
-} |
| 28 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,75 +0,0 @@ |
| 1 |
-// +build !windows |
|
| 2 |
- |
|
| 3 |
-package daemon |
|
| 4 |
- |
|
| 5 |
-import ( |
|
| 6 |
- "github.com/docker/docker/api/types" |
|
| 7 |
- "github.com/docker/docker/api/types/backend" |
|
| 8 |
- "github.com/docker/docker/api/types/versions/v1p19" |
|
| 9 |
- "github.com/docker/docker/container" |
|
| 10 |
- "github.com/docker/docker/daemon/exec" |
|
| 11 |
-) |
|
| 12 |
- |
|
| 13 |
-// This sets platform-specific fields |
|
| 14 |
-func setPlatformSpecificContainerFields(container *container.Container, contJSONBase *types.ContainerJSONBase) *types.ContainerJSONBase {
|
|
| 15 |
- contJSONBase.AppArmorProfile = container.AppArmorProfile |
|
| 16 |
- contJSONBase.ResolvConfPath = container.ResolvConfPath |
|
| 17 |
- contJSONBase.HostnamePath = container.HostnamePath |
|
| 18 |
- contJSONBase.HostsPath = container.HostsPath |
|
| 19 |
- |
|
| 20 |
- return contJSONBase |
|
| 21 |
-} |
|
| 22 |
- |
|
| 23 |
-// containerInspectPre120 gets containers for pre 1.20 APIs. |
|
| 24 |
-func (daemon *Daemon) containerInspectPre120(name string) (*v1p19.ContainerJSON, error) {
|
|
| 25 |
- container, err := daemon.GetContainer(name) |
|
| 26 |
- if err != nil {
|
|
| 27 |
- return nil, err |
|
| 28 |
- } |
|
| 29 |
- |
|
| 30 |
- container.Lock() |
|
| 31 |
- defer container.Unlock() |
|
| 32 |
- |
|
| 33 |
- base, err := daemon.getInspectData(container) |
|
| 34 |
- if err != nil {
|
|
| 35 |
- return nil, err |
|
| 36 |
- } |
|
| 37 |
- |
|
| 38 |
- volumes := make(map[string]string) |
|
| 39 |
- volumesRW := make(map[string]bool) |
|
| 40 |
- for _, m := range container.MountPoints {
|
|
| 41 |
- volumes[m.Destination] = m.Path() |
|
| 42 |
- volumesRW[m.Destination] = m.RW |
|
| 43 |
- } |
|
| 44 |
- |
|
| 45 |
- config := &v1p19.ContainerConfig{
|
|
| 46 |
- Config: container.Config, |
|
| 47 |
- MacAddress: container.Config.MacAddress, |
|
| 48 |
- NetworkDisabled: container.Config.NetworkDisabled, |
|
| 49 |
- ExposedPorts: container.Config.ExposedPorts, |
|
| 50 |
- VolumeDriver: container.HostConfig.VolumeDriver, |
|
| 51 |
- Memory: container.HostConfig.Memory, |
|
| 52 |
- MemorySwap: container.HostConfig.MemorySwap, |
|
| 53 |
- CPUShares: container.HostConfig.CPUShares, |
|
| 54 |
- CPUSet: container.HostConfig.CpusetCpus, |
|
| 55 |
- } |
|
| 56 |
- networkSettings := daemon.getBackwardsCompatibleNetworkSettings(container.NetworkSettings) |
|
| 57 |
- |
|
| 58 |
- return &v1p19.ContainerJSON{
|
|
| 59 |
- ContainerJSONBase: base, |
|
| 60 |
- Volumes: volumes, |
|
| 61 |
- VolumesRW: volumesRW, |
|
| 62 |
- Config: config, |
|
| 63 |
- NetworkSettings: networkSettings, |
|
| 64 |
- }, nil |
|
| 65 |
-} |
|
| 66 |
- |
|
| 67 |
-func inspectExecProcessConfig(e *exec.Config) *backend.ExecProcessConfig {
|
|
| 68 |
- return &backend.ExecProcessConfig{
|
|
| 69 |
- Tty: e.Tty, |
|
| 70 |
- Entrypoint: e.Entrypoint, |
|
| 71 |
- Arguments: e.Args, |
|
| 72 |
- Privileged: &e.Privileged, |
|
| 73 |
- User: e.User, |
|
| 74 |
- } |
|
| 75 |
-} |
| 76 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,102 @@ |
| 0 |
+package listeners |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "crypto/tls" |
|
| 4 |
+ "fmt" |
|
| 5 |
+ "net" |
|
| 6 |
+ "os" |
|
| 7 |
+ "strconv" |
|
| 8 |
+ |
|
| 9 |
+ "github.com/coreos/go-systemd/activation" |
|
| 10 |
+ "github.com/docker/go-connections/sockets" |
|
| 11 |
+ "github.com/sirupsen/logrus" |
|
| 12 |
+) |
|
| 13 |
+ |
|
| 14 |
+// Init creates new listeners for the server. |
|
| 15 |
+// TODO: Clean up the fact that socketGroup and tlsConfig aren't always used. |
|
| 16 |
+func Init(proto, addr, socketGroup string, tlsConfig *tls.Config) ([]net.Listener, error) {
|
|
| 17 |
+ ls := []net.Listener{}
|
|
| 18 |
+ |
|
| 19 |
+ switch proto {
|
|
| 20 |
+ case "fd": |
|
| 21 |
+ fds, err := listenFD(addr, tlsConfig) |
|
| 22 |
+ if err != nil {
|
|
| 23 |
+ return nil, err |
|
| 24 |
+ } |
|
| 25 |
+ ls = append(ls, fds...) |
|
| 26 |
+ case "tcp": |
|
| 27 |
+ l, err := sockets.NewTCPSocket(addr, tlsConfig) |
|
| 28 |
+ if err != nil {
|
|
| 29 |
+ return nil, err |
|
| 30 |
+ } |
|
| 31 |
+ ls = append(ls, l) |
|
| 32 |
+ case "unix": |
|
| 33 |
+ gid, err := lookupGID(socketGroup) |
|
| 34 |
+ if err != nil {
|
|
| 35 |
+ if socketGroup != "" {
|
|
| 36 |
+ if socketGroup != defaultSocketGroup {
|
|
| 37 |
+ return nil, err |
|
| 38 |
+ } |
|
| 39 |
+ logrus.Warnf("could not change group %s to %s: %v", addr, defaultSocketGroup, err)
|
|
| 40 |
+ } |
|
| 41 |
+ gid = os.Getgid() |
|
| 42 |
+ } |
|
| 43 |
+ l, err := sockets.NewUnixSocket(addr, gid) |
|
| 44 |
+ if err != nil {
|
|
| 45 |
+ return nil, fmt.Errorf("can't create unix socket %s: %v", addr, err)
|
|
| 46 |
+ } |
|
| 47 |
+ ls = append(ls, l) |
|
| 48 |
+ default: |
|
| 49 |
+ return nil, fmt.Errorf("invalid protocol format: %q", proto)
|
|
| 50 |
+ } |
|
| 51 |
+ |
|
| 52 |
+ return ls, nil |
|
| 53 |
+} |
|
| 54 |
+ |
|
| 55 |
+// listenFD returns the specified socket activated files as a slice of |
|
| 56 |
+// net.Listeners or all of the activated files if "*" is given. |
|
| 57 |
+func listenFD(addr string, tlsConfig *tls.Config) ([]net.Listener, error) {
|
|
| 58 |
+ var ( |
|
| 59 |
+ err error |
|
| 60 |
+ listeners []net.Listener |
|
| 61 |
+ ) |
|
| 62 |
+ // socket activation |
|
| 63 |
+ if tlsConfig != nil {
|
|
| 64 |
+ listeners, err = activation.TLSListeners(false, tlsConfig) |
|
| 65 |
+ } else {
|
|
| 66 |
+ listeners, err = activation.Listeners(false) |
|
| 67 |
+ } |
|
| 68 |
+ if err != nil {
|
|
| 69 |
+ return nil, err |
|
| 70 |
+ } |
|
| 71 |
+ |
|
| 72 |
+ if len(listeners) == 0 {
|
|
| 73 |
+ return nil, fmt.Errorf("no sockets found via socket activation: make sure the service was started by systemd")
|
|
| 74 |
+ } |
|
| 75 |
+ |
|
| 76 |
+ // default to all fds just like unix:// and tcp:// |
|
| 77 |
+ if addr == "" || addr == "*" {
|
|
| 78 |
+ return listeners, nil |
|
| 79 |
+ } |
|
| 80 |
+ |
|
| 81 |
+ fdNum, err := strconv.Atoi(addr) |
|
| 82 |
+ if err != nil {
|
|
| 83 |
+ return nil, fmt.Errorf("failed to parse systemd fd address: should be a number: %v", addr)
|
|
| 84 |
+ } |
|
| 85 |
+ fdOffset := fdNum - 3 |
|
| 86 |
+ if len(listeners) < fdOffset+1 {
|
|
| 87 |
+ return nil, fmt.Errorf("too few socket activated files passed in by systemd")
|
|
| 88 |
+ } |
|
| 89 |
+ if listeners[fdOffset] == nil {
|
|
| 90 |
+ return nil, fmt.Errorf("failed to listen on systemd activated file: fd %d", fdOffset+3)
|
|
| 91 |
+ } |
|
| 92 |
+ for i, ls := range listeners {
|
|
| 93 |
+ if i == fdOffset || ls == nil {
|
|
| 94 |
+ continue |
|
| 95 |
+ } |
|
| 96 |
+ if err := ls.Close(); err != nil {
|
|
| 97 |
+ return nil, fmt.Errorf("failed to close systemd activated file: fd %d: %v", fdOffset+3, err)
|
|
| 98 |
+ } |
|
| 99 |
+ } |
|
| 100 |
+ return []net.Listener{listeners[fdOffset]}, nil
|
|
| 101 |
+} |
| 0 | 102 |
deleted file mode 100644 |
| ... | ... |
@@ -1,43 +0,0 @@ |
| 1 |
-package listeners |
|
| 2 |
- |
|
| 3 |
-import ( |
|
| 4 |
- "crypto/tls" |
|
| 5 |
- "fmt" |
|
| 6 |
- "net" |
|
| 7 |
- "os" |
|
| 8 |
- |
|
| 9 |
- "github.com/docker/go-connections/sockets" |
|
| 10 |
- "github.com/sirupsen/logrus" |
|
| 11 |
-) |
|
| 12 |
- |
|
| 13 |
-// Init creates new listeners for the server. |
|
| 14 |
-func Init(proto, addr, socketGroup string, tlsConfig *tls.Config) (ls []net.Listener, err error) {
|
|
| 15 |
- switch proto {
|
|
| 16 |
- case "tcp": |
|
| 17 |
- l, err := sockets.NewTCPSocket(addr, tlsConfig) |
|
| 18 |
- if err != nil {
|
|
| 19 |
- return nil, err |
|
| 20 |
- } |
|
| 21 |
- ls = append(ls, l) |
|
| 22 |
- case "unix": |
|
| 23 |
- gid, err := lookupGID(socketGroup) |
|
| 24 |
- if err != nil {
|
|
| 25 |
- if socketGroup != "" {
|
|
| 26 |
- if socketGroup != defaultSocketGroup {
|
|
| 27 |
- return nil, err |
|
| 28 |
- } |
|
| 29 |
- logrus.Warnf("could not change group %s to %s: %v", addr, defaultSocketGroup, err)
|
|
| 30 |
- } |
|
| 31 |
- gid = os.Getgid() |
|
| 32 |
- } |
|
| 33 |
- l, err := sockets.NewUnixSocket(addr, gid) |
|
| 34 |
- if err != nil {
|
|
| 35 |
- return nil, fmt.Errorf("can't create unix socket %s: %v", addr, err)
|
|
| 36 |
- } |
|
| 37 |
- ls = append(ls, l) |
|
| 38 |
- default: |
|
| 39 |
- return nil, fmt.Errorf("Invalid protocol format: %q", proto)
|
|
| 40 |
- } |
|
| 41 |
- |
|
| 42 |
- return |
|
| 43 |
-} |
| 44 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,104 +0,0 @@ |
| 1 |
-// +build !windows |
|
| 2 |
- |
|
| 3 |
-package listeners |
|
| 4 |
- |
|
| 5 |
-import ( |
|
| 6 |
- "crypto/tls" |
|
| 7 |
- "fmt" |
|
| 8 |
- "net" |
|
| 9 |
- "os" |
|
| 10 |
- "strconv" |
|
| 11 |
- |
|
| 12 |
- "github.com/coreos/go-systemd/activation" |
|
| 13 |
- "github.com/docker/go-connections/sockets" |
|
| 14 |
- "github.com/sirupsen/logrus" |
|
| 15 |
-) |
|
| 16 |
- |
|
| 17 |
-// Init creates new listeners for the server. |
|
| 18 |
-// TODO: Clean up the fact that socketGroup and tlsConfig aren't always used. |
|
| 19 |
-func Init(proto, addr, socketGroup string, tlsConfig *tls.Config) ([]net.Listener, error) {
|
|
| 20 |
- ls := []net.Listener{}
|
|
| 21 |
- |
|
| 22 |
- switch proto {
|
|
| 23 |
- case "fd": |
|
| 24 |
- fds, err := listenFD(addr, tlsConfig) |
|
| 25 |
- if err != nil {
|
|
| 26 |
- return nil, err |
|
| 27 |
- } |
|
| 28 |
- ls = append(ls, fds...) |
|
| 29 |
- case "tcp": |
|
| 30 |
- l, err := sockets.NewTCPSocket(addr, tlsConfig) |
|
| 31 |
- if err != nil {
|
|
| 32 |
- return nil, err |
|
| 33 |
- } |
|
| 34 |
- ls = append(ls, l) |
|
| 35 |
- case "unix": |
|
| 36 |
- gid, err := lookupGID(socketGroup) |
|
| 37 |
- if err != nil {
|
|
| 38 |
- if socketGroup != "" {
|
|
| 39 |
- if socketGroup != defaultSocketGroup {
|
|
| 40 |
- return nil, err |
|
| 41 |
- } |
|
| 42 |
- logrus.Warnf("could not change group %s to %s: %v", addr, defaultSocketGroup, err)
|
|
| 43 |
- } |
|
| 44 |
- gid = os.Getgid() |
|
| 45 |
- } |
|
| 46 |
- l, err := sockets.NewUnixSocket(addr, gid) |
|
| 47 |
- if err != nil {
|
|
| 48 |
- return nil, fmt.Errorf("can't create unix socket %s: %v", addr, err)
|
|
| 49 |
- } |
|
| 50 |
- ls = append(ls, l) |
|
| 51 |
- default: |
|
| 52 |
- return nil, fmt.Errorf("invalid protocol format: %q", proto)
|
|
| 53 |
- } |
|
| 54 |
- |
|
| 55 |
- return ls, nil |
|
| 56 |
-} |
|
| 57 |
- |
|
| 58 |
-// listenFD returns the specified socket activated files as a slice of |
|
| 59 |
-// net.Listeners or all of the activated files if "*" is given. |
|
| 60 |
-func listenFD(addr string, tlsConfig *tls.Config) ([]net.Listener, error) {
|
|
| 61 |
- var ( |
|
| 62 |
- err error |
|
| 63 |
- listeners []net.Listener |
|
| 64 |
- ) |
|
| 65 |
- // socket activation |
|
| 66 |
- if tlsConfig != nil {
|
|
| 67 |
- listeners, err = activation.TLSListeners(false, tlsConfig) |
|
| 68 |
- } else {
|
|
| 69 |
- listeners, err = activation.Listeners(false) |
|
| 70 |
- } |
|
| 71 |
- if err != nil {
|
|
| 72 |
- return nil, err |
|
| 73 |
- } |
|
| 74 |
- |
|
| 75 |
- if len(listeners) == 0 {
|
|
| 76 |
- return nil, fmt.Errorf("no sockets found via socket activation: make sure the service was started by systemd")
|
|
| 77 |
- } |
|
| 78 |
- |
|
| 79 |
- // default to all fds just like unix:// and tcp:// |
|
| 80 |
- if addr == "" || addr == "*" {
|
|
| 81 |
- return listeners, nil |
|
| 82 |
- } |
|
| 83 |
- |
|
| 84 |
- fdNum, err := strconv.Atoi(addr) |
|
| 85 |
- if err != nil {
|
|
| 86 |
- return nil, fmt.Errorf("failed to parse systemd fd address: should be a number: %v", addr)
|
|
| 87 |
- } |
|
| 88 |
- fdOffset := fdNum - 3 |
|
| 89 |
- if len(listeners) < fdOffset+1 {
|
|
| 90 |
- return nil, fmt.Errorf("too few socket activated files passed in by systemd")
|
|
| 91 |
- } |
|
| 92 |
- if listeners[fdOffset] == nil {
|
|
| 93 |
- return nil, fmt.Errorf("failed to listen on systemd activated file: fd %d", fdOffset+3)
|
|
| 94 |
- } |
|
| 95 |
- for i, ls := range listeners {
|
|
| 96 |
- if i == fdOffset || ls == nil {
|
|
| 97 |
- continue |
|
| 98 |
- } |
|
| 99 |
- if err := ls.Close(); err != nil {
|
|
| 100 |
- return nil, fmt.Errorf("failed to close systemd activated file: fd %d: %v", fdOffset+3, err)
|
|
| 101 |
- } |
|
| 102 |
- } |
|
| 103 |
- return []net.Listener{listeners[fdOffset]}, nil
|
|
| 104 |
-} |
| 105 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,11 +0,0 @@ |
| 1 |
-package daemon |
|
| 2 |
- |
|
| 3 |
-import ( |
|
| 4 |
- "github.com/docker/docker/container" |
|
| 5 |
- "github.com/docker/docker/libcontainerd" |
|
| 6 |
-) |
|
| 7 |
- |
|
| 8 |
-// postRunProcessing perfoms any processing needed on the container after it has stopped. |
|
| 9 |
-func (daemon *Daemon) postRunProcessing(_ *container.Container, _ libcontainerd.EventInfo) error {
|
|
| 10 |
- return nil |
|
| 11 |
-} |
| 6 | 4 |
deleted file mode 100644 |
| ... | ... |
@@ -1,11 +0,0 @@ |
| 1 |
-package daemon |
|
| 2 |
- |
|
| 3 |
-import ( |
|
| 4 |
- "github.com/docker/docker/api/types/container" |
|
| 5 |
- "github.com/docker/docker/libcontainerd" |
|
| 6 |
-) |
|
| 7 |
- |
|
| 8 |
-func toContainerdResources(resources container.Resources) libcontainerd.Resources {
|
|
| 9 |
- var r libcontainerd.Resources |
|
| 10 |
- return r |
|
| 11 |
-} |
| 6 | 4 |
deleted file mode 100644 |
| ... | ... |
@@ -1,30 +0,0 @@ |
| 1 |
-package plugin |
|
| 2 |
- |
|
| 3 |
-import ( |
|
| 4 |
- "fmt" |
|
| 5 |
- |
|
| 6 |
- "github.com/docker/docker/plugin/v2" |
|
| 7 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 8 |
-) |
|
| 9 |
- |
|
| 10 |
-func (pm *Manager) enable(p *v2.Plugin, c *controller, force bool) error {
|
|
| 11 |
- return fmt.Errorf("Not implemented")
|
|
| 12 |
-} |
|
| 13 |
- |
|
| 14 |
-func (pm *Manager) initSpec(p *v2.Plugin) (*specs.Spec, error) {
|
|
| 15 |
- return nil, fmt.Errorf("Not implemented")
|
|
| 16 |
-} |
|
| 17 |
- |
|
| 18 |
-func (pm *Manager) disable(p *v2.Plugin, c *controller) error {
|
|
| 19 |
- return fmt.Errorf("Not implemented")
|
|
| 20 |
-} |
|
| 21 |
- |
|
| 22 |
-func (pm *Manager) restore(p *v2.Plugin) error {
|
|
| 23 |
- return fmt.Errorf("Not implemented")
|
|
| 24 |
-} |
|
| 25 |
- |
|
| 26 |
-// Shutdown plugins |
|
| 27 |
-func (pm *Manager) Shutdown() {
|
|
| 28 |
-} |
|
| 29 |
- |
|
| 30 |
-func setupRoot(root string) error { return nil }
|