1
0
Fork 0
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:
Charles Hooper 2013-03-14 01:48:50 +00:00
parent 3686feaccc
commit 06553a756b

View file

@ -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
} }