зеркало из https://github.com/microsoft/docker.git
Fix a bug which caused repository metadata to be cleared at startup
This commit is contained in:
Родитель
4af8b711c0
Коммит
d0c776528b
6
tags.go
6
tags.go
|
@ -3,6 +3,7 @@ package docker
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -24,9 +25,14 @@ func NewTagStore(path string, graph *Graph) (*TagStore, error) {
|
||||||
graph: graph,
|
graph: graph,
|
||||||
Repositories: make(map[string]Repository),
|
Repositories: make(map[string]Repository),
|
||||||
}
|
}
|
||||||
|
// Load the json file if it exists, otherwise create it.
|
||||||
|
if err := store.Reload(); os.IsNotExist(err) {
|
||||||
if err := store.Save(); err != nil {
|
if err := store.Save(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
} else if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
return store, nil
|
return store, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче