ops_unix.go 959 B

12345678910111213141516171819202122232425262728293031323334
  1. // +build !windows
  2. package daemon
  3. import (
  4. "path/filepath"
  5. "runtime"
  6. "github.com/docker/docker/daemon/images"
  7. "github.com/docker/docker/layer"
  8. // register graph drivers
  9. _ "github.com/docker/docker/daemon/graphdriver/register"
  10. "github.com/docker/docker/pkg/idtools"
  11. )
  12. // WithImageService sets imageService options
  13. func WithImageService(d *Daemon) {
  14. layerStores := make(map[string]layer.Store)
  15. os := runtime.GOOS
  16. layerStores[os], _ = layer.NewStoreFromOptions(layer.StoreOptions{
  17. Root: d.Root,
  18. MetadataStorePathTemplate: filepath.Join(d.RootDir(), "image", "%s", "layerdb"),
  19. GraphDriver: d.storageDriver,
  20. GraphDriverOptions: nil,
  21. IDMapping: &idtools.IdentityMapping{},
  22. PluginGetter: nil,
  23. ExperimentalEnabled: false,
  24. OS: os,
  25. })
  26. d.imageService = images.NewImageService(images.ImageServiceConfig{
  27. LayerStores: layerStores,
  28. })
  29. }