(ctx context.Context, project *types.Project, options api.CreateOptions)
| 66 | } |
| 67 | |
| 68 | func (s *composeService) create(ctx context.Context, project *types.Project, options api.CreateOptions) error { |
| 69 | if len(options.Services) == 0 { |
| 70 | options.Services = project.ServiceNames() |
| 71 | } |
| 72 | |
| 73 | err := project.CheckContainerNameUnicity() |
| 74 | if err != nil { |
| 75 | return err |
| 76 | } |
| 77 | |
| 78 | err = s.ensureImagesExists(ctx, project, options.Build, options.QuietPull) |
| 79 | if err != nil { |
| 80 | return err |
| 81 | } |
| 82 | |
| 83 | err = s.ensureModels(ctx, project, options.QuietPull) |
| 84 | if err != nil { |
| 85 | return err |
| 86 | } |
| 87 | |
| 88 | prepareNetworks(project) |
| 89 | |
| 90 | networks, err := s.ensureNetworks(ctx, project) |
| 91 | if err != nil { |
| 92 | return err |
| 93 | } |
| 94 | |
| 95 | volumes, err := s.ensureProjectVolumes(ctx, project) |
| 96 | if err != nil { |
| 97 | return err |
| 98 | } |
| 99 | |
| 100 | // Temporary implementation of use_api_socket until we get actual support inside docker engine |
| 101 | project, err = s.useAPISocket(project) |
| 102 | if err != nil { |
| 103 | return err |
| 104 | } |
| 105 | |
| 106 | observed, err := s.collectObservedState(ctx, project) |
| 107 | if err != nil { |
| 108 | return err |
| 109 | } |
| 110 | observed.setResolvedNetworks(networks, project) |
| 111 | observed.setResolvedVolumes(volumes) |
| 112 | |
| 113 | if len(observed.Orphans) > 0 && !options.IgnoreOrphans && !options.RemoveOrphans { |
| 114 | logrus.Warnf("Found orphan containers (%s) for this project. If "+ |
| 115 | "you removed or renamed this service in your compose "+ |
| 116 | "file, you can run this command with the "+ |
| 117 | "--remove-orphans flag to clean it up.", observed.orphanNames()) |
| 118 | } |
| 119 | |
| 120 | plan, err := reconcile(ctx, project, observed, toReconcileOptions(options), s.prompt) |
| 121 | if err != nil { |
| 122 | return err |
| 123 | } |
| 124 | |
| 125 | // Emit "Running" events for containers that are already up-to-date, |
no test coverage detected