| ... | ... |
@@ -8,9 +8,7 @@ import ( |
| 8 | 8 |
// FIXME: separate runtime configuration from http api configuration |
| 9 | 9 |
type DaemonConfig struct {
|
| 10 | 10 |
Pidfile string |
| 11 |
- // FIXME: don't call this GraphPath, it doesn't actually |
|
| 12 |
- // point to /var/lib/docker/graph, which is confusing. |
|
| 13 |
- GraphPath string |
|
| 11 |
+ Root string |
|
| 14 | 12 |
ProtoAddresses []string |
| 15 | 13 |
AutoRestart bool |
| 16 | 14 |
EnableCors bool |
| ... | ... |
@@ -26,7 +24,7 @@ type DaemonConfig struct {
|
| 26 | 26 |
func ConfigGetenv(job *engine.Job) *DaemonConfig {
|
| 27 | 27 |
var config DaemonConfig |
| 28 | 28 |
config.Pidfile = job.Getenv("Pidfile")
|
| 29 |
- config.GraphPath = job.Getenv("GraphPath")
|
|
| 29 |
+ config.Root = job.Getenv("Root")
|
|
| 30 | 30 |
config.AutoRestart = job.GetenvBool("AutoRestart")
|
| 31 | 31 |
config.EnableCors = job.GetenvBool("EnableCors")
|
| 32 | 32 |
if dns := job.Getenv("Dns"); dns != "" {
|
| ... | ... |
@@ -34,7 +34,7 @@ func main() {
|
| 34 | 34 |
flAutoRestart := flag.Bool("r", true, "Restart previously running containers")
|
| 35 | 35 |
bridgeName := flag.String("b", "", "Attach containers to a pre-existing network bridge. Use 'none' to disable container networking")
|
| 36 | 36 |
pidfile := flag.String("p", "/var/run/docker.pid", "File containing process PID")
|
| 37 |
- flGraphPath := flag.String("g", "/var/lib/docker", "Path to graph storage base dir.")
|
|
| 37 |
+ flRoot := flag.String("g", "/var/lib/docker", "Path to use as the root of the docker runtime.")
|
|
| 38 | 38 |
flEnableCors := flag.Bool("api-enable-cors", false, "Enable CORS requests in the remote api.")
|
| 39 | 39 |
flDns := flag.String("dns", "", "Set custom dns servers")
|
| 40 | 40 |
flHosts := utils.ListOpts{fmt.Sprintf("unix://%s", docker.DEFAULTUNIXSOCKET)}
|
| ... | ... |
@@ -71,7 +71,7 @@ func main() {
|
| 71 | 71 |
flag.Usage() |
| 72 | 72 |
return |
| 73 | 73 |
} |
| 74 |
- eng, err := engine.New(*flGraphPath) |
|
| 74 |
+ eng, err := engine.New(*flRoot) |
|
| 75 | 75 |
if err != nil {
|
| 76 | 76 |
log.Fatal(err) |
| 77 | 77 |
} |
| ... | ... |
@@ -80,7 +80,7 @@ func main() {
|
| 80 | 80 |
log.Fatal(err) |
| 81 | 81 |
} |
| 82 | 82 |
job.Setenv("Pidfile", *pidfile)
|
| 83 |
- job.Setenv("GraphPath", *flGraphPath)
|
|
| 83 |
+ job.Setenv("Root", *flRoot)
|
|
| 84 | 84 |
job.SetenvBool("AutoRestart", *flAutoRestart)
|
| 85 | 85 |
job.SetenvBool("EnableCors", *flEnableCors)
|
| 86 | 86 |
job.Setenv("Dns", *flDns)
|
| ... | ... |
@@ -582,21 +582,21 @@ func NewRuntime(config *DaemonConfig) (*Runtime, error) {
|
| 582 | 582 |
} |
| 583 | 583 |
|
| 584 | 584 |
func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
|
| 585 |
- runtimeRepo := path.Join(config.GraphPath, "containers") |
|
| 585 |
+ runtimeRepo := path.Join(config.Root, "containers") |
|
| 586 | 586 |
|
| 587 | 587 |
if err := os.MkdirAll(runtimeRepo, 0700); err != nil && !os.IsExist(err) {
|
| 588 | 588 |
return nil, err |
| 589 | 589 |
} |
| 590 | 590 |
|
| 591 |
- g, err := NewGraph(path.Join(config.GraphPath, "graph")) |
|
| 591 |
+ g, err := NewGraph(path.Join(config.Root, "graph")) |
|
| 592 | 592 |
if err != nil {
|
| 593 | 593 |
return nil, err |
| 594 | 594 |
} |
| 595 |
- volumes, err := NewGraph(path.Join(config.GraphPath, "volumes")) |
|
| 595 |
+ volumes, err := NewGraph(path.Join(config.Root, "volumes")) |
|
| 596 | 596 |
if err != nil {
|
| 597 | 597 |
return nil, err |
| 598 | 598 |
} |
| 599 |
- repositories, err := NewTagStore(path.Join(config.GraphPath, "repositories"), g) |
|
| 599 |
+ repositories, err := NewTagStore(path.Join(config.Root, "repositories"), g) |
|
| 600 | 600 |
if err != nil {
|
| 601 | 601 |
return nil, fmt.Errorf("Couldn't create Tag store: %s", err)
|
| 602 | 602 |
} |
| ... | ... |
@@ -608,7 +608,7 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
|
| 608 | 608 |
return nil, err |
| 609 | 609 |
} |
| 610 | 610 |
|
| 611 |
- gographPath := path.Join(config.GraphPath, "linkgraph.db") |
|
| 611 |
+ gographPath := path.Join(config.Root, "linkgraph.db") |
|
| 612 | 612 |
initDatabase := false |
| 613 | 613 |
if _, err := os.Stat(gographPath); err != nil {
|
| 614 | 614 |
if os.IsNotExist(err) {
|
| ... | ... |
@@ -46,8 +46,8 @@ func nuke(runtime *Runtime) error {
|
| 46 | 46 |
wg.Wait() |
| 47 | 47 |
runtime.Close() |
| 48 | 48 |
|
| 49 |
- os.Remove(filepath.Join(runtime.config.GraphPath, "linkgraph.db")) |
|
| 50 |
- return os.RemoveAll(runtime.config.GraphPath) |
|
| 49 |
+ os.Remove(filepath.Join(runtime.config.Root, "linkgraph.db")) |
|
| 50 |
+ return os.RemoveAll(runtime.config.Root) |
|
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 | 53 |
func cleanup(runtime *Runtime) error {
|
| ... | ... |
@@ -119,7 +119,7 @@ func init() {
|
| 119 | 119 |
|
| 120 | 120 |
func setupBaseImage() {
|
| 121 | 121 |
config := &DaemonConfig{
|
| 122 |
- GraphPath: unitTestStoreBase, |
|
| 122 |
+ Root: unitTestStoreBase, |
|
| 123 | 123 |
AutoRestart: false, |
| 124 | 124 |
BridgeIface: unitTestNetworkBridge, |
| 125 | 125 |
} |
| ... | ... |
@@ -158,7 +158,7 @@ func (srv *Server) ContainerExport(name string, out io.Writer) error {
|
| 158 | 158 |
} |
| 159 | 159 |
|
| 160 | 160 |
func (srv *Server) ImagesSearch(term string) ([]APISearch, error) {
|
| 161 |
- r, err := registry.NewRegistry(srv.runtime.config.GraphPath, nil, srv.HTTPRequestFactory(nil)) |
|
| 161 |
+ r, err := registry.NewRegistry(srv.runtime.config.Root, nil, srv.HTTPRequestFactory(nil)) |
|
| 162 | 162 |
if err != nil {
|
| 163 | 163 |
return nil, err |
| 164 | 164 |
} |
| ... | ... |
@@ -702,7 +702,7 @@ func (srv *Server) poolRemove(kind, key string) error {
|
| 702 | 702 |
} |
| 703 | 703 |
|
| 704 | 704 |
func (srv *Server) ImagePull(localName string, tag string, out io.Writer, sf *utils.StreamFormatter, authConfig *auth.AuthConfig, metaHeaders map[string][]string, parallel bool) error {
|
| 705 |
- r, err := registry.NewRegistry(srv.runtime.config.GraphPath, authConfig, srv.HTTPRequestFactory(metaHeaders)) |
|
| 705 |
+ r, err := registry.NewRegistry(srv.runtime.config.Root, authConfig, srv.HTTPRequestFactory(metaHeaders)) |
|
| 706 | 706 |
if err != nil {
|
| 707 | 707 |
return err |
| 708 | 708 |
} |
| ... | ... |
@@ -911,7 +911,7 @@ func (srv *Server) ImagePush(localName string, out io.Writer, sf *utils.StreamFo |
| 911 | 911 |
|
| 912 | 912 |
out = utils.NewWriteFlusher(out) |
| 913 | 913 |
img, err := srv.runtime.graph.Get(localName) |
| 914 |
- r, err2 := registry.NewRegistry(srv.runtime.config.GraphPath, authConfig, srv.HTTPRequestFactory(metaHeaders)) |
|
| 914 |
+ r, err2 := registry.NewRegistry(srv.runtime.config.Root, authConfig, srv.HTTPRequestFactory(metaHeaders)) |
|
| 915 | 915 |
if err2 != nil {
|
| 916 | 916 |
return err2 |
| 917 | 917 |
} |