{"record":{"id":"caa3d842b6794261","repo":"docker/compose","slug":"no-service-selected","errorCode":null,"errorMessage":"no service selected","messagePattern":"no service selected","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/compose/up.go","lineNumber":141,"sourceCode":"\t\t\tup.navigationMenuChanged = cmd.Flags().Changed(\"menu\")\n\t\t\tif !cmd.Flags().Changed(\"remove-orphans\") {\n\t\t\t\tcreate.removeOrphans = utils.StringToBool(os.Getenv(ComposeRemoveOrphans))\n\t\t\t}\n\t\t\treturn validateFlags(&up, &create)\n\t\t}),\n\t\tRunE: p.WithServices(dockerCli, func(ctx context.Context, project *types.Project, services []string) error {\n\t\t\tcreate.ignoreOrphans = utils.StringToBool(project.Environment[ComposeIgnoreOrphans])\n\t\t\tif create.ignoreOrphans && create.removeOrphans {\n\t\t\t\treturn fmt.Errorf(\"cannot combine %s and --remove-orphans\", ComposeIgnoreOrphans)\n\t\t\t}\n\t\t\tif len(up.attach) != 0 && up.attachDependencies {\n\t\t\t\treturn errors.New(\"cannot combine --attach and --attach-dependencies\")\n\t\t\t}\n\n\t\t\tup.resolveNavigationMenu(dockerCli)\n\n\t\t\tif !p.All && len(project.Services) == 0 {\n\t\t\t\treturn fmt.Errorf(\"no service selected\")\n\t\t\t}\n\n\t\t\treturn runUp(ctx, dockerCli, backendOptions, create, up, build, project, services)\n\t\t}),\n\t\tValidArgsFunction: completeServiceNames(dockerCli, p),\n\t}\n\tflags := upCmd.Flags()\n\tflags.BoolVarP(&up.Detach, \"detach\", \"d\", false, \"Detached mode: Run containers in the background\")\n\tflags.BoolVar(&create.Build, \"build\", false, \"Build images before starting containers\")\n\tflags.BoolVar(&create.noBuild, \"no-build\", false, \"Don't build an image, even if it's policy\")\n\tflags.StringVar(&create.Pull, \"pull\", \"policy\", `Pull image before running (\"always\"|\"missing\"|\"never\")`)\n\tflags.BoolVar(&create.removeOrphans, \"remove-orphans\", false, \"Remove containers for services not defined in the Compose file\")\n\tflags.StringArrayVar(&create.scale, \"scale\", []string{}, \"Scale SERVICE to NUM instances. Overrides the `scale` setting in the Compose file if present.\")\n\tflags.BoolVar(&up.noColor, \"no-color\", false, \"Produce monochrome output\")\n\tflags.BoolVar(&up.noPrefix, \"no-log-prefix\", false, \"Don't print prefix in logs\")\n\tflags.BoolVar(&create.forceRecreate, \"force-recreate\", false, \"Recreate containers even if their configuration and image haven't changed\")\n\tflags.BoolVar(&create.noRecreate, \"no-recreate\", false, \"If containers already exist, don't recreate them. Incompatible with --force-recreate.\")\n\tflags.BoolVar(&up.noStart, \"no-start\", false, \"Don't start the services after creating them\")","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/cmd/compose/up.go#L123-L159","documentation":"Returned by `docker compose up` when running without --all (-a) and the resolved project contains zero services. After p.WithServices loads and filters the project, an empty Services map means there is nothing to start, so Compose fails fast rather than silently doing nothing. Typically the project became empty because service selection via config profiles, directory-specific compose files, or the services arg filtered everything out.","triggerScenarios":"All services in compose.yml belong to profiles that are not activated (`profiles: [debug]` with no COMPOSE_PROFILES or --profile passed); running `up` in a directory whose compose file only defines top-level constructs (volumes/networks) but no services; a services arg that matches nothing; an empty compose file.","commonSituations":"A profile-gated service file where the user forgot to activate the profile; CI checking out only part of a multi-file setup so the merge results in zero services; COMPOSE_PROFILES left empty in a wrapper script; misnamed COMPOSE_FILE pointing at a YAML with no services key.","solutions":["Activate the profiles that own your services: `COMPOSE_PROFILES=debug docker compose up` or `docker compose --profile debug up`.","Verify the file actually defines services: `docker compose config --services` should list them.","Check COMPOSE_FILE / working directory so the intended compose file(s) are loaded.","If you genuinely want to run an empty project, pass --all (-a)."],"exampleFix":"# before\n# compose.yml: services have `profiles: [\"debug\"]`\ndocker compose up\n\n# after\ndocker compose --profile debug up","handlingStrategy":"validation","validationCode":"svcs=$(docker compose config --services 2>/dev/null)\nif [ -z \"$svcs\" ]; then echo \"no services after profile filtering\" >&2; exit 2; fi\ndocker compose up","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default required profiles via COMPOSE_PROFILES in .env.","Smoke-test compose files in CI with `docker compose config --services`.","Keep at least one non-profile service if `up` should always have work."],"tags":["cli","up","profiles","project-loading","compose"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}