mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Move remote API config out of daemon/
Signed-off-by: Solomon Hykes <solomon@docker.com>
This commit is contained in:
parent
1eba59eb24
commit
1d10c55aec
10 changed files with 11 additions and 20 deletions
|
@ -505,9 +505,6 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
|
||||||
if initPath := remoteInfo.Get("InitPath"); initPath != "" {
|
if initPath := remoteInfo.Get("InitPath"); initPath != "" {
|
||||||
fmt.Fprintf(cli.out, "Init Path: %s\n", 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 {
|
if len(remoteInfo.GetList("IndexServerAddress")) != 0 {
|
||||||
|
|
|
@ -36,7 +36,6 @@ type Config struct {
|
||||||
DisableNetwork bool
|
DisableNetwork bool
|
||||||
EnableSelinuxSupport bool
|
EnableSelinuxSupport bool
|
||||||
Context map[string][]string
|
Context map[string][]string
|
||||||
Sockets []string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// InstallFlags adds command-line options to the top-level flag parser for
|
// 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.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")
|
opts.ListVar(&config.GraphOptions, []string{"-storage-opt"}, "Set storage driver options")
|
||||||
// FIXME: why the inconsistency between "hosts" and "sockets"?
|
// 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.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")
|
opts.DnsSearchListVar(&config.DnsSearch, []string{"-dns-search"}, "Force Docker to use specific DNS search domains")
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,6 @@ type Daemon struct {
|
||||||
containerGraph *graphdb.Database
|
containerGraph *graphdb.Database
|
||||||
driver graphdriver.Driver
|
driver graphdriver.Driver
|
||||||
execDriver execdriver.Driver
|
execDriver execdriver.Driver
|
||||||
Sockets []string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Install installs daemon capabilities to eng.
|
// Install installs daemon capabilities to eng.
|
||||||
|
@ -851,7 +850,6 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
|
||||||
sysInitPath: sysInitPath,
|
sysInitPath: sysInitPath,
|
||||||
execDriver: ed,
|
execDriver: ed,
|
||||||
eng: eng,
|
eng: eng,
|
||||||
Sockets: config.Sockets,
|
|
||||||
}
|
}
|
||||||
if err := daemon.checkLocaldns(); err != nil {
|
if err := daemon.checkLocaldns(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -66,7 +66,6 @@ func (daemon *Daemon) CmdInfo(job *engine.Job) engine.Status {
|
||||||
v.Set("IndexServerAddress", registry.IndexServerAddress())
|
v.Set("IndexServerAddress", registry.IndexServerAddress())
|
||||||
v.Set("InitSha1", dockerversion.INITSHA1)
|
v.Set("InitSha1", dockerversion.INITSHA1)
|
||||||
v.Set("InitPath", initPath)
|
v.Set("InitPath", initPath)
|
||||||
v.SetList("Sockets", daemon.Sockets)
|
|
||||||
if _, err := v.WriteTo(job.Stdout); err != nil {
|
if _, err := v.WriteTo(job.Stdout); err != nil {
|
||||||
return job.Error(err)
|
return job.Error(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,8 +63,7 @@ func mainDaemon() {
|
||||||
)
|
)
|
||||||
|
|
||||||
// Serve api
|
// Serve api
|
||||||
// FIXME: 'Sockets' should not be part of daemon.Config
|
job := eng.Job("serveapi", flHosts...)
|
||||||
job := eng.Job("serveapi", daemonCfg.Sockets...)
|
|
||||||
job.SetenvBool("Logging", true)
|
job.SetenvBool("Logging", true)
|
||||||
job.SetenvBool("EnableCors", *flEnableCors)
|
job.SetenvBool("EnableCors", *flEnableCors)
|
||||||
job.Setenv("Version", dockerversion.VERSION)
|
job.Setenv("Version", dockerversion.VERSION)
|
||||||
|
|
|
@ -38,7 +38,7 @@ func main() {
|
||||||
os.Setenv("DEBUG", "1")
|
os.Setenv("DEBUG", "1")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(daemonCfg.Sockets) == 0 {
|
if len(flHosts) == 0 {
|
||||||
defaultHost := os.Getenv("DOCKER_HOST")
|
defaultHost := os.Getenv("DOCKER_HOST")
|
||||||
if defaultHost == "" || *flDaemon {
|
if defaultHost == "" || *flDaemon {
|
||||||
// If we do not have a host, default to unix socket
|
// If we do not have a host, default to unix socket
|
||||||
|
@ -47,7 +47,7 @@ func main() {
|
||||||
if _, err := api.ValidateHost(defaultHost); err != nil {
|
if _, err := api.ValidateHost(defaultHost); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
daemonCfg.Sockets = append(daemonCfg.Sockets, defaultHost)
|
flHosts = append(flHosts, defaultHost)
|
||||||
}
|
}
|
||||||
|
|
||||||
if *flDaemon {
|
if *flDaemon {
|
||||||
|
@ -55,10 +55,10 @@ func main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(daemonCfg.Sockets) > 1 {
|
if len(flHosts) > 1 {
|
||||||
log.Fatal("Please specify only one -H")
|
log.Fatal("Please specify only one -H")
|
||||||
}
|
}
|
||||||
protoAddrParts := strings.SplitN(daemonCfg.Sockets[0], "://", 2)
|
protoAddrParts := strings.SplitN(flHosts[0], "://", 2)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cli *client.DockerCli
|
cli *client.DockerCli
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/docker/docker/opts"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -30,10 +31,12 @@ var (
|
||||||
flCa *string
|
flCa *string
|
||||||
flCert *string
|
flCert *string
|
||||||
flKey *string
|
flKey *string
|
||||||
|
flHosts []string
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
flCa = flag.String([]string{"-tlscacert"}, filepath.Join(dockerCertPath, defaultCaFile), "Trust only remotes providing a certificate signed by the CA given here")
|
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")
|
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")
|
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.")
|
||||||
}
|
}
|
||||||
|
|
|
@ -1170,7 +1170,6 @@ Display system-wide information
|
||||||
"NGoroutines":21,
|
"NGoroutines":21,
|
||||||
"NEventsListener":0,
|
"NEventsListener":0,
|
||||||
"InitPath":"/usr/bin/docker",
|
"InitPath":"/usr/bin/docker",
|
||||||
"Sockets":["unix:///var/run/docker.sock"],
|
|
||||||
"IndexServerAddress":["https://index.docker.io/v1/"],
|
"IndexServerAddress":["https://index.docker.io/v1/"],
|
||||||
"MemoryLimit":true,
|
"MemoryLimit":true,
|
||||||
"SwapLimit":false,
|
"SwapLimit":false,
|
||||||
|
|
|
@ -1174,7 +1174,6 @@ Display system-wide information
|
||||||
"NGoroutines":21,
|
"NGoroutines":21,
|
||||||
"NEventsListener":0,
|
"NEventsListener":0,
|
||||||
"InitPath":"/usr/bin/docker",
|
"InitPath":"/usr/bin/docker",
|
||||||
"Sockets":["unix:///var/run/docker.sock"],
|
|
||||||
"IndexServerAddress":["https://index.docker.io/v1/"],
|
"IndexServerAddress":["https://index.docker.io/v1/"],
|
||||||
"MemoryLimit":true,
|
"MemoryLimit":true,
|
||||||
"SwapLimit":false,
|
"SwapLimit":false,
|
||||||
|
|
|
@ -616,7 +616,6 @@ For example:
|
||||||
Goroutines: 9
|
Goroutines: 9
|
||||||
EventsListeners: 0
|
EventsListeners: 0
|
||||||
Init Path: /usr/bin/docker
|
Init Path: /usr/bin/docker
|
||||||
Sockets: [unix:///var/run/docker.sock]
|
|
||||||
Username: svendowideit
|
Username: svendowideit
|
||||||
Registry: [https://index.docker.io/v1/]
|
Registry: [https://index.docker.io/v1/]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue