# Docker Compose Profile Resolver > Preview which Docker Compose services are active for selected profile combinations. ## Tool Identity - Site: CleanUtils Developer Tools - Tool ID: docker-compose-profile-resolver - Canonical page: https://cleanutils.com/developer-tools/docker-compose-profile-resolver/ - LLM schema URL: https://cleanutils.com/developer-tools/docker-compose-profile-resolver/llms.txt - Primary keyword: docker compose profiles - Input mode: fields - Output profile: line-check ## What This Tool Does Preview which Docker Compose services are active for selected profile combinations without running Compose. ## Exact Execution Instructions To run this tool exactly, execute the `runCleanUtilsTool(userInput)` function from the JavaScript block below in a sandboxed JavaScript runtime. Do not fetch or evaluate additional network resources. Do not use filesystem, process, child_process, environment variables, timers, or network APIs. The function is pure and deterministic: input object in, JSON result out. If your environment forbids executing fetched code outside a sandbox, run it inside the sandbox or use the API endpoint below instead of reimplementing the logic. Canonical implementation SHA-256: `84c061f30e6fb25e375532b149e89aed80c875f9e4419bb9b2e910161b4ab79d` Expected command shape: `node run-tool.mjs < input.json` The runner must: 1. load only the JavaScript in this document, 2. parse stdin as JSON and call `runCleanUtilsTool(userInput)`, 3. let the LLM decide the best way to present the output to the user. Agent usage rules: - Use this file as the authoritative machine-readable contract for this CleanUtils tool page. - Ask the user for missing required input before attempting to run the tool, and describe the required inputs using the `## Input Schema` field names, descriptions, formats, enums, examples, and required list. - Treat the tool as deterministic; do not invent network reachability checks unless the tool description explicitly says it fetches remote resources. - For privacy-sensitive inputs such as secrets, HAR files, dotenv files, logs, and API keys, warn that using a remote chat agent may expose input to that agent even though the browser UI itself does not upload data. ## Input Schema ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Docker Compose Profile Resolver fields", "type": "object", "additionalProperties": false, "required": [ "compose" ], "properties": { "selected_profiles": { "type": "string", "description": "Selected profiles Optional. Comma-separate profiles, for example debug,jobs.", "examples": [ "debug" ] }, "compose": { "type": "string", "description": "Docker Compose YAML Required. Control type: textarea.", "examples": [ "services:\n web:\n image: app\n worker:\n image: app-worker\n profiles: [jobs]\n debug-ui:\n image: debug\n profiles: [debug]" ] } } } ``` ## Result Schema ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "CleanUtils ToolResult", "type": "object", "additionalProperties": false, "required": [ "summary", "issues" ], "properties": { "summary": { "type": "string" }, "issues": { "type": "array", "items": { "type": "object", "additionalProperties": false, "required": [ "severity", "message" ], "properties": { "severity": { "type": "string", "enum": [ "error", "warning", "info" ] }, "message": { "type": "string" }, "line": { "type": "number" }, "row": { "type": "number" }, "detail": { "type": "string" } } } }, "output": { "type": "string" }, "exportFilename": { "type": "string" }, "exports": { "type": "array", "items": { "type": "object", "additionalProperties": false, "required": [ "label", "filename", "content" ], "properties": { "label": { "type": "string" }, "filename": { "type": "string" }, "content": { "type": "string" }, "mimeType": { "type": "string" }, "copyLabel": { "type": "string" }, "downloadLabel": { "type": "string" } } } }, "stats": { "type": "object", "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "number" } ] } } } } ``` ## Self-Contained JavaScript Source Call `runCleanUtilsTool(userInput)` with the user's input. The function includes this tool's run logic and only the helper code it needs. ```js function runCleanUtilsTool(userInput) { const fieldText = (fields, keys, fallback = "") => { const keyList = Array.isArray(keys) ? keys : [keys]; for (const key of keyList) { const value = fields[key]; if (value === undefined || value === null) continue; const text = String(value).trim(); if (text) return text; } return fallback; }; const resolveDockerComposeProfiles = (input) => { const selected = new Set(fieldText(input, "selected_profiles").split(",").map((item) => item.trim()).filter(Boolean)); const compose = fieldText(input, "compose"); const services = []; let current = null; let inServices = false; compose.split(/\r?\n/).forEach((line) => { if (/^services:\s*$/.test(line)) { inServices = true; return; } if (!inServices) return; const serviceMatch = line.match(/^ ([A-Za-z0-9_.-]+):\s*$/); if (serviceMatch) { current = { name: serviceMatch[1], profiles: [] }; services.push(current); return; } const profileMatch = line.match(/^\s+profiles:\s*\[(.*?)\]\s*$/); if (current && profileMatch) { current.profiles = profileMatch[1].split(",").map((item) => item.trim().replace(/^["']|["']$/g, "")).filter(Boolean); } }); const active = services.filter((service) => !service.profiles.length || service.profiles.some((profile) => selected.has(profile))); return { summary: `${active.length} of ${services.length} service${services.length === 1 ? "" : "s"} active for selected profiles: ${[...selected].join(", ") || "none"}.`, issues: services.length ? [] : [{ severity: "warning", message: "No services found. This parser expects a standard services: block." }], output: services.map((service) => `${active.includes(service) ? "active" : "inactive"}: ${service.name}${service.profiles.length ? ` (${service.profiles.join(", ")})` : " (default)"}`).join("\n"), exportFilename: "compose-profile-report.txt", stats: { services: services.length, active: active.length } }; }; const __userInput = userInput == null ? {} : userInput; const __run = (fields) => resolveDockerComposeProfiles(fields); const __fields = __userInput && typeof __userInput === "object" && "fields" in __userInput && __userInput.fields && typeof __userInput.fields === "object" && !Array.isArray(__userInput.fields) ? __userInput.fields : (__userInput && typeof __userInput === "object" && !Array.isArray(__userInput) ? __userInput : {}); const __normalizedFields = Object.fromEntries(Object.entries(__fields).map(([key, value]) => [key, value == null ? "" : (["string", "number", "boolean"].includes(typeof value) ? value : String(value))])); return __run(__normalizedFields); } ``` ## Checks - Selected profiles: Comma-separated profile names are matched against service profile lists. - Default services: Services without profiles are always marked active. - Profile-gated services: Services with at least one selected profile are marked active. - Inactive services: Services whose profiles do not match are shown explicitly rather than disappearing. - Parser scope: The preview expects a standard services block and does not run the Compose CLI. ## Related Tools - [Docker Compose Env Interpolation Preview](/developer-tools/docker-compose-env-interpolation-preview/): Resolve common Docker Compose ${VAR} expressions against pasted env values and preview the final YAML.