diff --git a/config.go b/config.go index a572cfadaf..1f32d8fb3e 100644 --- a/config.go +++ b/config.go @@ -8,9 +8,7 @@ import ( // FIXME: separate runtime configuration from http api configuration type DaemonConfig struct { Pidfile string - // FIXME: don't call this GraphPath, it doesn't actually - // point to /var/lib/docker/graph, which is confusing. - GraphPath string + Root string ProtoAddresses []string AutoRestart bool EnableCors bool @@ -26,7 +24,7 @@ type DaemonConfig struct { func ConfigGetenv(job *engine.Job) *DaemonConfig { var config DaemonConfig config.Pidfile = job.Getenv("Pidfile") - config.GraphPath = job.Getenv("GraphPath") + config.Root = job.Getenv("Root") config.AutoRestart = job.GetenvBool("AutoRestart") config.EnableCors = job.GetenvBool("EnableCors") if dns := job.Getenv("Dns"); dns != "" { diff --git a/docker/docker.go b/docker/docker.go index 7487dba86f..cd0369636d 100644 --- a/docker/docker.go +++ b/docker/docker.go @@ -34,7 +34,7 @@ func main() { flAutoRestart := flag.Bool("r", true, "Restart previously running containers") bridgeName := flag.String("b", "", "Attach containers to a pre-existing network bridge. Use 'none' to disable container networking") pidfile := flag.String("p", "/var/run/docker.pid", "File containing process PID") - flGraphPath := flag.String("g", "/var/lib/docker", "Path to graph storage base dir.") + flRoot := flag.String("g", "/var/lib/docker", "Path to use as the root of the docker runtime.") flEnableCors := flag.Bool("api-enable-cors", false, "Enable CORS requests in the remote api.") flDns := flag.String("dns", "", "Set custom dns servers") flHosts := utils.ListOpts{fmt.Sprintf("unix://%s", docker.DEFAULTUNIXSOCKET)} @@ -71,7 +71,7 @@ func main() { flag.Usage() return } - eng, err := engine.New(*flGraphPath) + eng, err := engine.New(*flRoot) if err != nil { log.Fatal(err) } @@ -80,7 +80,7 @@ func main() { log.Fatal(err) } job.Setenv("Pidfile", *pidfile) - job.Setenv("GraphPath", *flGraphPath) + job.Setenv("Root", *flRoot) job.SetenvBool("AutoRestart", *flAutoRestart) job.SetenvBool("EnableCors", *flEnableCors) job.Setenv("Dns", *flDns) diff --git a/runtime.go b/runtime.go index cdd53c58f3..22c5d572bf 100644 --- a/runtime.go +++ b/runtime.go @@ -582,21 +582,21 @@ func NewRuntime(config *DaemonConfig) (*Runtime, error) { } func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) { - runtimeRepo := path.Join(config.GraphPath, "containers") + runtimeRepo := path.Join(config.Root, "containers") if err := os.MkdirAll(runtimeRepo, 0700); err != nil && !os.IsExist(err) { return nil, err } - g, err := NewGraph(path.Join(config.GraphPath, "graph")) + g, err := NewGraph(path.Join(config.Root, "graph")) if err != nil { return nil, err } - volumes, err := NewGraph(path.Join(config.GraphPath, "volumes")) + volumes, err := NewGraph(path.Join(config.Root, "volumes")) if err != nil { return nil, err } - repositories, err := NewTagStore(path.Join(config.GraphPath, "repositories"), g) + repositories, err := NewTagStore(path.Join(config.Root, "repositories"), g) if err != nil { return nil, fmt.Errorf("Couldn't create Tag store: %s", err) } @@ -608,7 +608,7 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) { return nil, err } - gographPath := path.Join(config.GraphPath, "linkgraph.db") + gographPath := path.Join(config.Root, "linkgraph.db") initDatabase := false if _, err := os.Stat(gographPath); err != nil { if os.IsNotExist(err) { diff --git a/runtime_test.go b/runtime_test.go index 085e5be1a3..662dfee657 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -46,8 +46,8 @@ func nuke(runtime *Runtime) error { wg.Wait() runtime.Close() - os.Remove(filepath.Join(runtime.config.GraphPath, "linkgraph.db")) - return os.RemoveAll(runtime.config.GraphPath) + os.Remove(filepath.Join(runtime.config.Root, "linkgraph.db")) + return os.RemoveAll(runtime.config.Root) } func cleanup(runtime *Runtime) error { @@ -119,7 +119,7 @@ func init() { func setupBaseImage() { config := &DaemonConfig{ - GraphPath: unitTestStoreBase, + Root: unitTestStoreBase, AutoRestart: false, BridgeIface: unitTestNetworkBridge, } diff --git a/server.go b/server.go index c5de67d60c..e6cc729a99 100644 --- a/server.go +++ b/server.go @@ -158,7 +158,7 @@ func (srv *Server) ContainerExport(name string, out io.Writer) error { } func (srv *Server) ImagesSearch(term string) ([]APISearch, error) { - r, err := registry.NewRegistry(srv.runtime.config.GraphPath, nil, srv.HTTPRequestFactory(nil)) + r, err := registry.NewRegistry(srv.runtime.config.Root, nil, srv.HTTPRequestFactory(nil)) if err != nil { return nil, err } @@ -702,7 +702,7 @@ func (srv *Server) poolRemove(kind, key string) error { } func (srv *Server) ImagePull(localName string, tag string, out io.Writer, sf *utils.StreamFormatter, authConfig *auth.AuthConfig, metaHeaders map[string][]string, parallel bool) error { - r, err := registry.NewRegistry(srv.runtime.config.GraphPath, authConfig, srv.HTTPRequestFactory(metaHeaders)) + r, err := registry.NewRegistry(srv.runtime.config.Root, authConfig, srv.HTTPRequestFactory(metaHeaders)) if err != nil { return err } @@ -911,7 +911,7 @@ func (srv *Server) ImagePush(localName string, out io.Writer, sf *utils.StreamFo out = utils.NewWriteFlusher(out) img, err := srv.runtime.graph.Get(localName) - r, err2 := registry.NewRegistry(srv.runtime.config.GraphPath, authConfig, srv.HTTPRequestFactory(metaHeaders)) + r, err2 := registry.NewRegistry(srv.runtime.config.Root, authConfig, srv.HTTPRequestFactory(metaHeaders)) if err2 != nil { return err2 } diff --git a/utils_test.go b/utils_test.go index 917c4c1591..ec0aa1e013 100644 --- a/utils_test.go +++ b/utils_test.go @@ -67,7 +67,7 @@ func newTestRuntime(prefix string) (runtime *Runtime, err error) { } config := &DaemonConfig{ - GraphPath: root, + Root: root, AutoRestart: false, } runtime, err = NewRuntimeFromDirectory(config)