зеркало из https://github.com/microsoft/docker.git
Move remote API config out of daemon/
Signed-off-by: Solomon Hykes <solomon@docker.com>
This commit is contained in:
Родитель
1eba59eb24
Коммит
1d10c55aec
|
@ -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 {
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.")
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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/]
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче