From 1d10c55aec891df609d36c90ee6c30adb24c16c4 Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Mon, 11 Aug 2014 22:30:01 +0000 Subject: [PATCH] Move remote API config out of daemon/ Signed-off-by: Solomon Hykes --- api/client/commands.go | 3 --- daemon/config.go | 2 -- daemon/daemon.go | 2 -- daemon/info.go | 1 - docker/daemon.go | 3 +-- docker/docker.go | 8 ++++---- docker/flags.go | 9 ++++++--- docs/sources/reference/api/docker_remote_api_v1.13.md | 1 - docs/sources/reference/api/docker_remote_api_v1.14.md | 1 - docs/sources/reference/commandline/cli.md | 1 - 10 files changed, 11 insertions(+), 20 deletions(-) diff --git a/api/client/commands.go b/api/client/commands.go index e4c1808f1c..99856ee5eb 100644 --- a/api/client/commands.go +++ b/api/client/commands.go @@ -505,9 +505,6 @@ func (cli *DockerCli) CmdInfo(args ...string) error { if initPath := remoteInfo.Get("InitPath"); initPath != "" { fmt.Fprintf(cli.out, "Init Path: %s\n", initPath) } - if len(remoteInfo.GetList("Sockets")) != 0 { - fmt.Fprintf(cli.out, "Sockets: %v\n", remoteInfo.GetList("Sockets")) - } } if len(remoteInfo.GetList("IndexServerAddress")) != 0 { diff --git a/daemon/config.go b/daemon/config.go index 9de5f3e185..5d0ea6ac12 100644 --- a/daemon/config.go +++ b/daemon/config.go @@ -36,7 +36,6 @@ type Config struct { DisableNetwork bool EnableSelinuxSupport bool Context map[string][]string - Sockets []string } // InstallFlags adds command-line options to the top-level flag parser for @@ -59,7 +58,6 @@ func (config *Config) InstallFlags() { opts.IPVar(&config.DefaultIp, []string{"#ip", "-ip"}, "0.0.0.0", "Default IP address to use when binding container ports") opts.ListVar(&config.GraphOptions, []string{"-storage-opt"}, "Set storage driver options") // FIXME: why the inconsistency between "hosts" and "sockets"? - opts.HostListVar(&config.Sockets, []string{"H", "-host"}, "The socket(s) to bind to in daemon mode\nspecified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd.") opts.IPListVar(&config.Dns, []string{"#dns", "-dns"}, "Force Docker to use specific DNS servers") opts.DnsSearchListVar(&config.DnsSearch, []string{"-dns-search"}, "Force Docker to use specific DNS search domains") } diff --git a/daemon/daemon.go b/daemon/daemon.go index f68197b2f6..540ee7d985 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -98,7 +98,6 @@ type Daemon struct { containerGraph *graphdb.Database driver graphdriver.Driver execDriver execdriver.Driver - Sockets []string } // Install installs daemon capabilities to eng. @@ -851,7 +850,6 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error) sysInitPath: sysInitPath, execDriver: ed, eng: eng, - Sockets: config.Sockets, } if err := daemon.checkLocaldns(); err != nil { return nil, err diff --git a/daemon/info.go b/daemon/info.go index 215d82acdc..d028a8341f 100644 --- a/daemon/info.go +++ b/daemon/info.go @@ -66,7 +66,6 @@ func (daemon *Daemon) CmdInfo(job *engine.Job) engine.Status { v.Set("IndexServerAddress", registry.IndexServerAddress()) v.Set("InitSha1", dockerversion.INITSHA1) v.Set("InitPath", initPath) - v.SetList("Sockets", daemon.Sockets) if _, err := v.WriteTo(job.Stdout); err != nil { return job.Error(err) } diff --git a/docker/daemon.go b/docker/daemon.go index 948412ea86..dc9d56d1d9 100644 --- a/docker/daemon.go +++ b/docker/daemon.go @@ -63,8 +63,7 @@ func mainDaemon() { ) // Serve api - // FIXME: 'Sockets' should not be part of daemon.Config - job := eng.Job("serveapi", daemonCfg.Sockets...) + job := eng.Job("serveapi", flHosts...) job.SetenvBool("Logging", true) job.SetenvBool("EnableCors", *flEnableCors) job.Setenv("Version", dockerversion.VERSION) diff --git a/docker/docker.go b/docker/docker.go index 2cd8165733..f2b4ca90b1 100644 --- a/docker/docker.go +++ b/docker/docker.go @@ -38,7 +38,7 @@ func main() { os.Setenv("DEBUG", "1") } - if len(daemonCfg.Sockets) == 0 { + if len(flHosts) == 0 { defaultHost := os.Getenv("DOCKER_HOST") if defaultHost == "" || *flDaemon { // If we do not have a host, default to unix socket @@ -47,7 +47,7 @@ func main() { if _, err := api.ValidateHost(defaultHost); err != nil { log.Fatal(err) } - daemonCfg.Sockets = append(daemonCfg.Sockets, defaultHost) + flHosts = append(flHosts, defaultHost) } if *flDaemon { @@ -55,10 +55,10 @@ func main() { return } - if len(daemonCfg.Sockets) > 1 { + if len(flHosts) > 1 { log.Fatal("Please specify only one -H") } - protoAddrParts := strings.SplitN(daemonCfg.Sockets[0], "://", 2) + protoAddrParts := strings.SplitN(flHosts[0], "://", 2) var ( cli *client.DockerCli diff --git a/docker/flags.go b/docker/flags.go index cb22751042..baae40eafc 100644 --- a/docker/flags.go +++ b/docker/flags.go @@ -4,6 +4,7 @@ import ( "os" "path/filepath" + "github.com/docker/docker/opts" flag "github.com/docker/docker/pkg/mflag" ) @@ -27,13 +28,15 @@ var ( flTlsVerify = flag.Bool([]string{"-tlsverify"}, false, "Use TLS and verify the remote (daemon: verify client, client: verify daemon)") // these are initialized in init() below since their default values depend on dockerCertPath which isn't fully initialized until init() runs - flCa *string - flCert *string - flKey *string + flCa *string + flCert *string + flKey *string + flHosts []string ) func init() { flCa = flag.String([]string{"-tlscacert"}, filepath.Join(dockerCertPath, defaultCaFile), "Trust only remotes providing a certificate signed by the CA given here") flCert = flag.String([]string{"-tlscert"}, filepath.Join(dockerCertPath, defaultCertFile), "Path to TLS certificate file") flKey = flag.String([]string{"-tlskey"}, filepath.Join(dockerCertPath, defaultKeyFile), "Path to TLS key file") + opts.HostListVar(&flHosts, []string{"H", "-host"}, "The socket(s) to bind to in daemon mode\nspecified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd.") } diff --git a/docs/sources/reference/api/docker_remote_api_v1.13.md b/docs/sources/reference/api/docker_remote_api_v1.13.md index cf21aefb00..d782391476 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.13.md +++ b/docs/sources/reference/api/docker_remote_api_v1.13.md @@ -1170,7 +1170,6 @@ Display system-wide information "NGoroutines":21, "NEventsListener":0, "InitPath":"/usr/bin/docker", - "Sockets":["unix:///var/run/docker.sock"], "IndexServerAddress":["https://index.docker.io/v1/"], "MemoryLimit":true, "SwapLimit":false, diff --git a/docs/sources/reference/api/docker_remote_api_v1.14.md b/docs/sources/reference/api/docker_remote_api_v1.14.md index e411c8c6ef..9a9c36e54b 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.14.md +++ b/docs/sources/reference/api/docker_remote_api_v1.14.md @@ -1174,7 +1174,6 @@ Display system-wide information "NGoroutines":21, "NEventsListener":0, "InitPath":"/usr/bin/docker", - "Sockets":["unix:///var/run/docker.sock"], "IndexServerAddress":["https://index.docker.io/v1/"], "MemoryLimit":true, "SwapLimit":false, diff --git a/docs/sources/reference/commandline/cli.md b/docs/sources/reference/commandline/cli.md index 311fc849e9..5e6107cfaa 100644 --- a/docs/sources/reference/commandline/cli.md +++ b/docs/sources/reference/commandline/cli.md @@ -616,7 +616,6 @@ For example: Goroutines: 9 EventsListeners: 0 Init Path: /usr/bin/docker - Sockets: [unix:///var/run/docker.sock] Username: svendowideit Registry: [https://index.docker.io/v1/]