start_windows.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package daemon
  2. import (
  3. "github.com/Microsoft/opengcs/client"
  4. "github.com/docker/docker/container"
  5. "github.com/docker/docker/libcontainerd"
  6. )
  7. func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Container) ([]libcontainerd.CreateOption, error) {
  8. createOptions := []libcontainerd.CreateOption{}
  9. // LCOW options.
  10. if container.Platform == "linux" {
  11. config := &client.Config{}
  12. if err := config.GenerateDefault(daemon.configStore.GraphOptions); err != nil {
  13. return nil, err
  14. }
  15. // Override from user-supplied options.
  16. for k, v := range container.HostConfig.StorageOpt {
  17. switch k {
  18. case "lcow.kirdpath":
  19. config.KirdPath = v
  20. case "lcow.kernel":
  21. config.KernelFile = v
  22. case "lcow.initrd":
  23. config.InitrdFile = v
  24. case "lcow.vhdx":
  25. config.Vhdx = v
  26. case "lcow.bootparameters":
  27. config.BootParameters = v
  28. }
  29. }
  30. if err := config.Validate(); err != nil {
  31. return nil, err
  32. }
  33. lcowOpts := &libcontainerd.LCOWOption{
  34. Config: config,
  35. }
  36. createOptions = append(createOptions, lcowOpts)
  37. }
  38. return createOptions, nil
  39. }