mirror of https://github.com/docker/docs.git
Rename 'GraphPath' to the more logical 'Root'. This does not affect users except for a slight text change in the usage messge
This commit is contained in:
parent
1b8eef4efb
commit
7e691e11b0
|
|
@ -8,9 +8,7 @@ import (
|
||||||
// FIXME: separate runtime configuration from http api configuration
|
// FIXME: separate runtime configuration from http api configuration
|
||||||
type DaemonConfig struct {
|
type DaemonConfig struct {
|
||||||
Pidfile string
|
Pidfile string
|
||||||
// FIXME: don't call this GraphPath, it doesn't actually
|
Root string
|
||||||
// point to /var/lib/docker/graph, which is confusing.
|
|
||||||
GraphPath string
|
|
||||||
ProtoAddresses []string
|
ProtoAddresses []string
|
||||||
AutoRestart bool
|
AutoRestart bool
|
||||||
EnableCors bool
|
EnableCors bool
|
||||||
|
|
@ -26,7 +24,7 @@ type DaemonConfig struct {
|
||||||
func ConfigGetenv(job *engine.Job) *DaemonConfig {
|
func ConfigGetenv(job *engine.Job) *DaemonConfig {
|
||||||
var config DaemonConfig
|
var config DaemonConfig
|
||||||
config.Pidfile = job.Getenv("Pidfile")
|
config.Pidfile = job.Getenv("Pidfile")
|
||||||
config.GraphPath = job.Getenv("GraphPath")
|
config.Root = job.Getenv("Root")
|
||||||
config.AutoRestart = job.GetenvBool("AutoRestart")
|
config.AutoRestart = job.GetenvBool("AutoRestart")
|
||||||
config.EnableCors = job.GetenvBool("EnableCors")
|
config.EnableCors = job.GetenvBool("EnableCors")
|
||||||
if dns := job.Getenv("Dns"); dns != "" {
|
if dns := job.Getenv("Dns"); dns != "" {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ func main() {
|
||||||
flAutoRestart := flag.Bool("r", true, "Restart previously running containers")
|
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")
|
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")
|
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.")
|
flEnableCors := flag.Bool("api-enable-cors", false, "Enable CORS requests in the remote api.")
|
||||||
flDns := flag.String("dns", "", "Set custom dns servers")
|
flDns := flag.String("dns", "", "Set custom dns servers")
|
||||||
flHosts := utils.ListOpts{fmt.Sprintf("unix://%s", docker.DEFAULTUNIXSOCKET)}
|
flHosts := utils.ListOpts{fmt.Sprintf("unix://%s", docker.DEFAULTUNIXSOCKET)}
|
||||||
|
|
@ -71,7 +71,7 @@ func main() {
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
eng, err := engine.New(*flGraphPath)
|
eng, err := engine.New(*flRoot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
@ -80,7 +80,7 @@ func main() {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
job.Setenv("Pidfile", *pidfile)
|
job.Setenv("Pidfile", *pidfile)
|
||||||
job.Setenv("GraphPath", *flGraphPath)
|
job.Setenv("Root", *flRoot)
|
||||||
job.SetenvBool("AutoRestart", *flAutoRestart)
|
job.SetenvBool("AutoRestart", *flAutoRestart)
|
||||||
job.SetenvBool("EnableCors", *flEnableCors)
|
job.SetenvBool("EnableCors", *flEnableCors)
|
||||||
job.Setenv("Dns", *flDns)
|
job.Setenv("Dns", *flDns)
|
||||||
|
|
|
||||||
10
runtime.go
10
runtime.go
|
|
@ -582,21 +582,21 @@ func NewRuntime(config *DaemonConfig) (*Runtime, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRuntimeFromDirectory(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) {
|
if err := os.MkdirAll(runtimeRepo, 0700); err != nil && !os.IsExist(err) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
g, err := NewGraph(path.Join(config.GraphPath, "graph"))
|
g, err := NewGraph(path.Join(config.Root, "graph"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
volumes, err := NewGraph(path.Join(config.GraphPath, "volumes"))
|
volumes, err := NewGraph(path.Join(config.Root, "volumes"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
repositories, err := NewTagStore(path.Join(config.GraphPath, "repositories"), g)
|
repositories, err := NewTagStore(path.Join(config.Root, "repositories"), g)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Couldn't create Tag store: %s", err)
|
return nil, fmt.Errorf("Couldn't create Tag store: %s", err)
|
||||||
}
|
}
|
||||||
|
|
@ -608,7 +608,7 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
gographPath := path.Join(config.GraphPath, "linkgraph.db")
|
gographPath := path.Join(config.Root, "linkgraph.db")
|
||||||
initDatabase := false
|
initDatabase := false
|
||||||
if _, err := os.Stat(gographPath); err != nil {
|
if _, err := os.Stat(gographPath); err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ func nuke(runtime *Runtime) error {
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
runtime.Close()
|
runtime.Close()
|
||||||
|
|
||||||
os.Remove(filepath.Join(runtime.config.GraphPath, "linkgraph.db"))
|
os.Remove(filepath.Join(runtime.config.Root, "linkgraph.db"))
|
||||||
return os.RemoveAll(runtime.config.GraphPath)
|
return os.RemoveAll(runtime.config.Root)
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanup(runtime *Runtime) error {
|
func cleanup(runtime *Runtime) error {
|
||||||
|
|
@ -119,7 +119,7 @@ func init() {
|
||||||
|
|
||||||
func setupBaseImage() {
|
func setupBaseImage() {
|
||||||
config := &DaemonConfig{
|
config := &DaemonConfig{
|
||||||
GraphPath: unitTestStoreBase,
|
Root: unitTestStoreBase,
|
||||||
AutoRestart: false,
|
AutoRestart: false,
|
||||||
BridgeIface: unitTestNetworkBridge,
|
BridgeIface: unitTestNetworkBridge,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ func (srv *Server) ContainerExport(name string, out io.Writer) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (srv *Server) ImagesSearch(term string) ([]APISearch, 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 {
|
if err != nil {
|
||||||
return nil, err
|
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 {
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -911,7 +911,7 @@ func (srv *Server) ImagePush(localName string, out io.Writer, sf *utils.StreamFo
|
||||||
|
|
||||||
out = utils.NewWriteFlusher(out)
|
out = utils.NewWriteFlusher(out)
|
||||||
img, err := srv.runtime.graph.Get(localName)
|
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 {
|
if err2 != nil {
|
||||||
return err2
|
return err2
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ func newTestRuntime(prefix string) (runtime *Runtime, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
config := &DaemonConfig{
|
config := &DaemonConfig{
|
||||||
GraphPath: root,
|
Root: root,
|
||||||
AutoRestart: false,
|
AutoRestart: false,
|
||||||
}
|
}
|
||||||
runtime, err = NewRuntimeFromDirectory(config)
|
runtime, err = NewRuntimeFromDirectory(config)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue