mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Create docker directories *before* allocating a LayerStore
This commit is contained in:
parent
3686feaccc
commit
06553a756b
1 changed files with 7 additions and 5 deletions
12
docker.go
12
docker.go
|
@ -109,6 +109,12 @@ func New() (*Docker, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFromDirectory(root string) (*Docker, error) {
|
func NewFromDirectory(root string) (*Docker, error) {
|
||||||
|
docker_repo := path.Join(root, "containers")
|
||||||
|
|
||||||
|
if err := os.MkdirAll(docker_repo, 0700); err != nil && !os.IsExist(err) {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
store, err := fs.New(path.Join(root, "images"))
|
store, err := fs.New(path.Join(root, "images"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -120,16 +126,12 @@ func NewFromDirectory(root string) (*Docker, error) {
|
||||||
|
|
||||||
docker := &Docker{
|
docker := &Docker{
|
||||||
root: root,
|
root: root,
|
||||||
repository: path.Join(root, "containers"),
|
repository: docker_repo,
|
||||||
containers: list.New(),
|
containers: list.New(),
|
||||||
Store: store,
|
Store: store,
|
||||||
networkManager: netManager,
|
networkManager: netManager,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := os.MkdirAll(docker.repository, 0700); err != nil && !os.IsExist(err) {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := docker.restore(); err != nil {
|
if err := docker.restore(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue